Monday, July 22, 2019

CSS :not() with Multiple Classes

Say you want to select an element when it doesn't have a certain class. That's what the :not() selector is for.

body:not(.home) {
  
}

But what if there are multiple classes you want to avoid?

There are no logical combinators with :not(), like and or or, but you can chain them, which is effectively like and.

body:not(.home):not(.away):not(.page-50) {
  
}

The :not() selector doesn't add any specificy by itself, but what is inside does, so :not(.foo) adds the same weight as .foo does.

The post CSS :not() with Multiple Classes appeared first on CSS-Tricks.

from CSS-Tricks https://css-tricks.com/css-not-with-multiple-classes/

The following blog post CSS :not() with Multiple Classes See more on: Instant Web Site Tools Blog



source https://www.instant-web-site-tools.com/2019/07/22/css-not-with-multiple-classes/

No comments:

Post a Comment

40+ Best Minimal Logo Design Templates

Minimalist logo design is an art. How can you convey your brand with a professional logo, but keep the simplicity of a minimal, clean, and s...