Andrew's Digital Garden

:not selector

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.

<selector to match>:not(<selector to avoid matching>)

This can be useful for creating specific selectors that rely on other selectors not being present at the time, e.g input:not(:focus) or input:not(:disabled).

You can negate several selectors at the same time. Example: :not(.foo, .bar) is equivalent to :not(.foo):not(.bar).

Interestingly, this also allows you to create a [[20220627095528-donut-scope]].

https://developer.mozilla.org/en-US/docs/Web/CSS/:not

[[css]]

Referred in

:not selector