CSS :valid Pseudo-class
Example
Select and style valid <input> elements:
input:valid {
background-color: beige;
border: 2px solid
green;
}
Try it Yourself »
Definition and Usage
The :valid
pseudo-class is used to style
valid form elements.
Tip: Use the :invalid selector to style invalid form elements.
Version: | CSS4 |
---|
Browser Support
The numbers in the table specifies the first browser version that fully supports the pseudo-class.
Pseudo-class | |||||
---|---|---|---|---|---|
:valid | 10 | 12 | 4 | 5 | 10 |
CSS Syntax
Related Pages
CSS Selector :invalid