这里是我的
在HTML中:
box
类。.rectangle-box {
width: 200px;
height: 30px;
background: #808080;
opacity: 0.3;
float: right;
}
.rectangle-red {
width: 65px;
height: 30px;
background: #ff4742;
opacity: 1;
float: left;
}
在HTML中:
<div class="rectangle-box">
<div class="rectangle-red"></div>
</div>
演示:https://jsfiddle.net/uq6ectfc/1/
我需要让rectangle-red
的不透明度为1
,而rectangle-box
的不透明度为0.3
。但是它们都受到父元素不透明度的影响。
我该如何解决这个问题?