我有一个不透明属性为0.5的父级div,子级是我想要不透明度为1的箭头。问题是子元素始终从父级继承0.5。我如何将箭头的不透明度更改为1?父元素,即,矩形必须保留不透明度0.5和子必须具有不透明度1.将属性更改为元素子
<div class='contenedor_flecha_prev'>
<i class="fa fa-chevron-left flecha_izqu" ></i>
</div>
.contenedor_flecha_prev{
position: fixed;
height: 80%;
width: 8%;
background: black;
bottom: 10%;
min-width: 35px;
left: 0px;
z-index: 90;
opacity:0.5;
cursor:pointer;
-webkit-transition: all 0.4s ease-in-out;
-moz-transition: all 0.4s ease-in-out;
transition: all 0.4s ease-in-out;
}
.fa.fa-chevron-left.flecha_izqu{
font-size: 55px;
color: white;
position: absolute;
top: 50%;
left: 50%;
-webkit-transform: translate(-50%,-50%);
transform: translate(-50%,-50%);
-moz-transform: translate(-50%,-50%);
opacity: 1;
}
Chrome on windows 10 ha小提琴是你想要的方式。你在浏览什么浏览器? – mikeg542
如果它只是你想要不透明的背景,使用'background:rgba(0,0,0,0.5);'而不是'black'并移除'opacity:0.5' –
不,不。做'body {background:red;}'来测试它。 – Miro