CSS :not() Pseudo-Class
- Previous Page :modal
- Next Page :nth-child()
- Go to Parent Level CSS Pseudo-class Reference Manual
Definition and Usage
CSS :not()
Pseudo-classes are used to match any element that is not the specified elementselector.
Example
Example 1
Set text color for all elements that are not <p> elements:
:not(p) { color: red; }
Example 2
More Examples :not()
Example:
.special { border: 2px solid maroon; } p:not(.special) { color: green; } body :not(p) { text-decoration: underline; } body :not(div):not(.special) { font-weight: bold; }
CSS Syntax
:not(selector) { css declarations; }
Technical Details
Version: | CSS3 |
---|
Browser Support
The numbers in the table specify the first browser version to fully support this pseudo-class.
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
4.0 | 9.0 | 3.5 | 3.2 | 9.6 |
- Previous Page :modal
- Next Page :nth-child()
- Go to Parent Level CSS Pseudo-class Reference Manual