Using the :focus Selector
Description
:focus selects elements with focus.
Example
The following code uses the :focus Selector.
<!DOCTYPE HTML>
<html>
<head>
<style type="text/css">
:focus {<!--from www . ja v a 2s .co m-->
border: thin black solid;
padding: 4px;
}
</style>
</head>
<body>
<form>
Name: <input type="text" name="name" />
<p />
City: <input type="text" name="city" />
<p />
<input type="submit" />
</form>
</body>
</html>