What is css “[class*=my-class] .my-subclass” doing?

前端 未结 2 1549
予麋鹿
予麋鹿 2021-01-18 18:14

I inherited some css and I have searched everywhere online to understand what is being expressed by a block of css that looks like:

 [class*=wrapper] .logo {         


        
2条回答
  •  借酒劲吻你
    2021-01-18 18:51

    It selects an element with class logo that has an ancestor that has wrapper somewhere in its class attribute. For example note that the class burgerwrapper also leads to the element being selected below.

    [class*=wrapper] .logo {
      color: #f99;
    }
    
    
    

    See http://css-tricks.com/attribute-selectors/ for some background information on attribute selectors.

提交回复
热议问题