reset multiple css styles for one single div element

前端 未结 3 1349
心在旅途
心在旅途 2020-12-29 09:09

my question is if it is possible to reset css styles (a lot off them) for a single div and all elements that are contained in that div.

I am asking, because I found

3条回答
  •  南方客
    南方客 (楼主)
    2020-12-29 09:57

    Try this:

    div.foo, div.foo *
    {
        // your styles
    }
    

    which will apply the styles to the div with class "foo" and all its descendants. The star (*) is known as the universal selector, and not surprisingly, selects elements of any type.

    Or for just the immediate children:

    div.foo, div.foo > *
    {
        // your styles
    }
    

提交回复
热议问题