案例:CSS案例     状态:可编辑再运行    进入竖版
 运行结果 
x
 
1
<!DOCTYPE html>
2
<html>
3
<head>
4
<style>
5
img
6
{
7
opacity:0.4;
8
filter:alpha(opacity=40); /* For IE8 and earlier */
9
}
10
img:hover
11
{
12
opacity:1.0;
13
filter:alpha(opacity=100); /* For IE8 and earlier */
14
}
15
</style>
16
</head>
17
<body>
18
19
<h1>图像透明度</h1>
20
21
<img src="/img/tulip_peach_blossom_s.jpg" alt="Peach Blossom" />
22
23
<p><b>注释:</b>在 IE 中,必须添加 <!DOCTYPE>,这样才能将 :hover 选择器用于除了 <a> 之外的其它元素。</p>
24
</body>
25
</html>