The :out-of-range
CSS pseudo-class represents an <input>
element whose current value is outside the range limits specified by the min
and max
attributes.
/* Selects any <input>, but only when it has a range specified, and its value is outside that range */ input:out-of-range { background-color: rgba(255, 0, 0, 0.25); }
This pseudo-class is useful for giving the user a visual indication that a field's current value is outside the permitted limits.
Note: This pseudo-class only applies to elements that have (and can take) a range limitation. In the absence of such a limitation, the element can neither be "in-range" nor "out-of-range."