Edit This Code:
See Result »
<!DOCTYPE html> <html> <head> <style> input:invalid { border: 2px solid red; } </style> <script> var _hmt = _hmt || []; (function() { var hm = document.createElement("script"); hm.src = "//hm.baidu.com/hm.js?73c27e26f610eb3c9f3feb0c75b03925"; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(hm, s); })(); </script> </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>
Result: