1、字体透明度

<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
    <style>
        #test{
            background-color:#000
        }
        #test span{
            color:#fff;
            zoom:1 /*触发IE下块级元素*/
            filter:alpha(opacity=50);
            -moz-opacity:0.5;
            opacity:0.5;
        }
    </style>
</head>
<body>
    <div id="test">
        <span>前景色透明度</span>
    </div>
</body>
</html>

2、图片透明度

img
{
opacity:0.4;
filter:alpha(opacity=40); /* For IE8 and earlier */
}
img:hover
{
opacity:1.0;
filter:alpha(opacity=100); /* For IE8 and earlier */
}

3、容器透明度

.pxs_bg .pxs_bg2{
    background-image:url(../images/bg2.png);
    opacity:0.3;
    filter:alpha(opacity=30);
    /*left negative 1/4 of ww*/
}


备注:想设置背景图片的透明度,可以通过设置容器透明度来操作

目前还没有直接设置背景图片透明度的方式

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐