HTML CSS examples for CSS Selector:invalid
The :invalid selector selects invalid form elements.
The invalid form elements includes input elements with min and max value out of range, email fields without a legal email, or number fields without a numeric value, etc.
Select only if the value of the <input> element is invalid:
<!DOCTYPE html> <html> <head> <style> input:invalid {<!--from w w w. j a v a 2s. com--> border: 2px solid red; } </style> </head> <body> <input type="email" value="an Email address"> <p>Try typing a legal e-mail address.</p> </body> </html>