案例:CSS3 案例     状态:可编辑再运行    进入竖版
 运行结果 
x
 
1
<!DOCTYPE html>
2
<html>
3
<head>
4
<style>
5
input:focus
6
{
7
background-color:yellow;
8
}
9
</style>
10
</head>
11
<body>
12
13
<p>在文本框中点击,您会看到黄色的背景:</p>
14
15
<form>
16
First name: <input type="text" name="firstname" /><br>
17
Last name: <input type="text" name="lastname" />
18
</form>
19
20
<p><b>注释:</b>如果 :focus 用于 IE8 ,则必须声明 <!DOCTYPE></p>
21
22
</body>
23
</html>
24