form state pseudo-classes
Pseudo-classes such as :checked, :invalid and :disabled that match form controls by their current state.
In more detail
They update automatically as the user interacts with the form. Combined with :has(), they let a container react to its fields, for example highlighting a label whose checkbox is ticked.
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).
- 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.
- checkbox — A form control that can be checked or unchecked, usually submitted with a form.
Taught in
- Modern Selectors: :has(), :is(), :where() And Nesting Standards — Frontend Architecture & Web Platform