Can I write a CSS selector selecting elements NOT having a certain class or attribute?

前端 未结 10 637
不知归路
不知归路 2020-11-22 10:47

I would like to write a CSS selector rule that selects all elements that don\'t have a certain class. For example, given the following HTML:



        
10条回答
  •  暖寄归人
    2020-11-22 11:27

    Example

      [class*='section-']:not(.section-name) {
        @include opacity(0.6);
        // Write your css code here
      }
    

    // Opacity 0.6 all "section-" but not "section-name"

提交回复
热议问题