案例:CSS案例     状态:可编辑再运行    进入竖版
 运行结果 
x
 
1
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
<html>
3
<head>
4
<style type="text/css">
5
input:focus
6
{
7
background-color:yellow;
8
}
9
</style>
10
</head>
11
12
<body>
13
<form action="/example/html/form_action.aspx" method="get">
14
First name: <input type="text" name="fname" /><br />
15
Last name: <input type="text" name="lname" /><br />
16
<input type="submit" value="Submit" />
17
</form>
18
19
<p><b>注释:</b>如果已规定 !DOCTYPE,那么 Internet Explorer 8 (以及更高版本)支持 :focus 伪类。</p>
20
21
</body>
22
</html>