:not()
The negation pseudo-class, :not(X), is a functional notation taking a simple selector (excluding the negation pseudo-class itself) as an argument. It represents an element that is not represented by its argument. 6.6.7. The negation pseudo-class
Links about :not()
The CSS3 :not() selector
Old post, but still popular and relevant.
:not() | CSS-Tricks
The :not(X) property in CSS is a negation pseudo class and accepts a simple selector1 as an argument. Essentially, just another selector of any kind. :not
:not()
The :not() CSS pseudo-class represents elements that do not match a list of selectors. Since it prevents specific items from being selected, it is known as the negation pseudo-class.
Code sample
li:not(:last-child) {
margin-botton: 1rem;
}
Explore other pages
- article
Represents a self-contained composition in a document, page, or application.
- grid-row
Determines a grid item’s size and location within the grid .
- content
Dictates what is rendered inside an element or pseudo-element.
- ::marker
The ::marker pseudo-element represents the automatically generated marker box of a list item.