Tuesday, August 20, 2013

CSS pseudo focus

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<style type="text/css">
input:focus
{
background-color:yellow;
}
</style>
</head>

<body>
<form action="form_action.asp" method="get">
First name: <input type="text" name="fname" /><br />
Last name: <input type="text" name="lname" /><br />
<input type="submit" value="Submit" />
</form>

<p><b>Note:</b> Internet Explorer 8 (and higher) supports the :focus pseudo-class if a !DOCTYPE is specified.</p>

</body>
</html>

Result


No comments: