<!DOCTYPE html>
<html>
<head>
<style>
input:valid {
    background-color: yellow;
}

</style>
</head>
<body>

<h3>A demonstration of the :valid selector.</h3>

<input type="email" value="support@exampel.com">

<p>Try typing an illegal e-mail address, to see the styling disappear.</p>

<p><strong>Note</strong>: The :valid selector is not supported in Internet Explorer 9 and earlier versions.</p>

</body>
</html>