Easy Tutorial
❮ Func Repeating Radial Gradient Sel Empty ❯

CSS :invalid Selector

Complete CSS Selector Reference

Example

Set the style to red if the value in an input element is invalid:

input:invalid
{ 
    border:2px solid red;
}

Definition and Usage

The :invalid selector is used to apply a specific style when the value in a form element is invalid.

Note: The :invalid selector only works on elements that can specify range values, such as the min and max attributes in input elements, and correct email fields, valid number fields, etc.


Browser Support

The numbers in the table represent the first browser version that supports this property.

Selector
:invalid 10.0 10.0 4.0 5.0 10.0

CSS Syntax


Related Pages

CSS Selector :valid


Complete CSS Selector Reference

❮ Func Repeating Radial Gradient Sel Empty ❯