Skip to content

CSS Selectors

Not

About

The :not(selector list) pseudo-class matches elements that do not match any of the selectors in the selector list.

Element without class

The selector :not(.item) matches all elements that do not have the class item.

Element not hovered

The selector :not(:hover) matches all elements that are not hovered.

  • Hover over the button, the selector will not match anymore

Element not of type

The selector :not(h1) matches all elements that are noth1 elements.

Multiple selectors

The pseudo-class accepts multiple selectors which are separated by comma. The selector :not(h1, .item) matches all elements that are not h1 and don't have the class item.