pseudo-class
A selector keyword starting with a colon, such as :hover, :checked or :has(), that matches elements by state or relationship rather than by name.
In more detail
Most pseudo-classes add the same specificity as a class. Functional ones such as :is(), :where() and :has() take selector lists as arguments.
Related terms
- :has() — A CSS pseudo-class that matches an element if something inside it, or after it, matches the given selector, such as .card:has(img).
- :is() — A CSS pseudo-class that matches any element matching one of the selectors in its list, such as :is(header, form) input.
- :where() — A CSS pseudo-class that works like :is() but always adds zero specificity, whatever its arguments.
- CSS selector — A pattern, such as .card, #menu or nav a, that picks which elements a CSS rule applies to or which elements a DOM query returns.
Taught in
- Modern Selectors: :has(), :is(), :where() And Nesting Standards — Frontend Architecture & Web Platform