代码:
<body>
<div class="shadeDivWrap">
<div class="shadeDiv"> </div>
<p>这个背景放在透明DIV中</p>
</div>
<div >
<img class="img_w" src="
" />
<p>这个图片没放在透明DIV中</p>
</div>
</body>
</html>
-----------------------------------------------------------------------------------------------------------------------
上样式:
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>css实现背景图片透明</title>
<style>
body{ background:#e1e1e1;}
p{margin-top:3px;}
.shadeDivWrap{width:290px; margin:0px 1px; z-index:10; height:120px; padding-top:10px; position:absolute; top:130px;}
.shadeDiv{ width:289px; height:91px; background:url(
) no-repeat; background-color:#777777; opacity:0.57;filter:alpha(opacity=57); z-index:-1; potmgion:absolute; }
.shadeDivWrap p{width:100%;margin-top:3px;}
.img_w{width:289px; height:91px;}
</style>
</head>
<body>
<div class="shadeDivWrap">
<div class="shadeDiv"> </div>
<p>这个背景放在透明DIV中</p>
</div>
<div >
<img class="img_w" src="

" />
<p>这个图片没放在透明DIV中</p>
</div>
</body>
</html>
-----------------------------------------------------------------------------------------------------------------------
上样式:
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>css实现背景图片透明</title>
<style>
body{ background:#e1e1e1;}
p{margin-top:3px;}
.shadeDivWrap{width:290px; margin:0px 1px; z-index:10; height:120px; padding-top:10px; position:absolute; top:130px;}
.shadeDiv{ width:289px; height:91px; background:url(

) no-repeat; background-color:#777777; opacity:0.57;filter:alpha(opacity=57); z-index:-1; potmgion:absolute; }
.shadeDivWrap p{width:100%;margin-top:3px;}
.img_w{width:289px; height:91px;}
</style>
</head>



