Black Lives Matter! ✊🏾

: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()

  1. The CSS3 :not() selector

    posted on by Kilian Valkhof

    Old post, but still popular and relevant.

  2. :not() | CSS-Tricks

    posted on by Sara Cope

    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

  3. :not()

    posted on by MDN

    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;
}