我已将外包装的不透明度设置为(0.5)。然而,这设置了所有内在元素'不透明度(0.5)也。我怎样才能使内部元素的不透明度为1?谢谢!
//..The HTML..//
<div class="nav-wrapper">
<div class="circle1"></div>
<div class="circle2"></div>
<div class="circle3"></div>
<div class="circle4"></div>
<div class="circle5"></div>
</div>
//..The CSS..//
.circle1 {
width: 80px;
height: 80px;
border-radius: 50%;
background: #BBBBBB;
}
.nav-wrapper {
height: 100%;
width: 100%;
top: 0;
opacity: 0.5;
background: white;
}
答案 0 :(得分:3)
对于nav-wrapper
,您应该使用rgba背景而不是不透明度.nav-wrapper {
height: 100%;
width: 100%;
top: 0;
//opacity: 0.5;
//background: white;
background: rgba(255,255,255, 0.5);
}
答案 1 :(得分:2)
你不能。这不是不透明的工作方式。请改用background: rgba(255,255,255,0.5);
。 (rgba();
是带RGB和不透明度的颜色)
答案 2 :(得分:1)