我正在尝试创建一个弹出式叠加层,但我不能让蓝色叠加层变得不透明。红色显示出来。
<a href="www.google.com">hi</a>
<div class="dim">
<div class="test">
<div> test </div>
<div> 2nd </div>
</div>
</div>
.dim {
height:100%;
width:100%;
position:fixed;
left:0;
top:0;
background-color:red;
opacity: 0.5;
}
.test {
opacity: 1.0;
border: solid;
display: inline-block;
background-color:blue;
position: fixed;
top: 50%;
left: 50%;
margin-top: -10px;
margin-left: -10px;
}
答案 0 :(得分:1)
将html写为 -
<a href="www.google.com">hi</a>
<div class="dim">
</div>
<div class="test">
<div> test </div>
<div> 2nd </div>
</div>
答案 1 :(得分:1)
简单的解决方法是复制和粘贴,将.dim放在.test。
之外来自
<a href="www.google.com">hi</a>
<div class="dim">
<div class="test">
<div> test </div>
<div> 2nd </div>
</div>
</div>
要
<a href="www.google.com">hi</a>
<div class="dim">
</div>
<div class="test">
<div> test </div>
<div> 2nd </div>
</div>