div半透明遮罩效果

时间:2022-10-19 10:23:58

效果

div半透明遮罩效果

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>半透明div</title>
    <style>
        #div1 { margin:0px auto; width:500px; height:370px ; text-align:center; background:url('http://www.codefans.net/jscss/demoimg/wall3.jpg');}
        #div2 {  height:330px; filter:alpha(Opacity=80);-moz-opacity:0.5;opacity: 0.5;z-index:100; background-color:#ffffff;  }
    </style>
</head>
<body>
<div id="div1">
    <div style="padding:20px;">
        <div id="div2">这里是透明的DIV</div>
    </div>
</div>
</body>
</html>