HTML CSS examples for CSS Selector:valid
The :valid selector selects valid form elements.
The valid form elements includes as input elements with min and max attributes, email fields with a legal email, or number fields with a numeric value, etc.
Select only if the value of the <input> element is valid:
<!DOCTYPE html> <html> <head> <style> input:valid {<!--from w ww. j av a 2s . com--> background-color: yellow; } </style> </head> <body> <input type="email" value="support@a.com"> <input type="email" value="support.com"> </body> </html>