Css Div半透明
用CSS控制外層DIV不透明,而內(nèi)層DIV透明,這樣實(shí)現(xiàn)的效果是意想不到的,還不錯(cuò)吧,其實(shí)代碼也是很簡單的,也很好理解,主要是用了CSS的濾鏡。
<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(/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>
參考:http://www.codefans.net/jscss/code/1061.shtml
轉(zhuǎn)載于:https://www.cnblogs.com/aiqingqing/p/4526327.html
總結(jié)
以上是生活随笔為你收集整理的Css Div半透明的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 演奏力度
- 下一篇: 将一个Excel文件分隔成多个