我有两个 div,外部和内部 div。我有一个背景图片,外部 div 设置了不透明度,但是我似乎无法让内部 div 不继承外部 div 的不透明度。我希望内部 div 是纯色。
我的代码在下面,这里有一个 jsfiddle:http://jsfiddle.net/3TK3U/
<style type="text/css">
body
{
background-image:url('http://media-bubble.info/images/layout/background.png');
}
.outsideBox {
width:70%;
height:200px;
background-color: #ffffff;
opacity:0.7;
filter:alpha(opacity=70);
text-align:center;
}
.insideBox {
width:40%;
height:80px;
background-color: #999;
z-index:999999;
}
</style>
<div id="Introduction" class="outsideBox">
<div id="Introduction" class="insideBox">This is the inside box which should not inherit transparancy</div>
</div>
最佳答案
尝试使用
背景颜色:rgba(255,255,255,0.7);
没有应使背景透明但不影响元素内容的不透明度或滤镜。
关于CSS div 不透明度仅在外部 div,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20131802/