CSS :invalid Selector
HTML Code
<!DOCTYPE html>
<html>
<head>
<style>
input:invalid {
border: 2px solid red;
}
</style>
</head>
<body>
<h3>A demonstration of the :invalid selector.</h3>
<input type=”email” value=”supportEmail”>
<p>Try typing a legal e-mail address, to see the styling disappear.</p>
<p><strong>Note</strong>: The :invalid selector is not supported in Internet Explorer 9 and earlier versions.</p>
</body>
</html>
HTML View
A demonstration of the :invalid selector.
Try typing a legal e-mail address, to see the styling disappear.
Note: The :invalid selector is not supported in Internet Explorer 9 and earlier versions.