Web features explorer

Form validity pseudo-classes

Widely available since 2018-01-29
Tags: css Groups: CSS > Selectors

The form validity CSS pseudo-classes match <form> elements based on the constraints of a form field, such as validity (:valid, :invalid, :in-range, :out-of-range) and necessity (:optional or :required).

Learning resources on MDN

Browser support (view on caniuse.com)