[英]Opacity background with white text
Trying to get a black background with opacity and white text over top. 试图获得不透明的黑色背景和顶部的白色文本。
I followed an answer on here, but it didn't work for me. 我在这里遵循了一个答案,但是它对我没有用。
Needing it compatible for IE8. 需要与IE8兼容。
http://jsfiddle.net/0khfo2cf/ http://jsfiddle.net/0khfo2cf/
#carousel .image_text{
position: absolute;
margin:0 auto;
text-align:center;
bottom:55px;
left:0;
right:0;
width:700px;
min-height:0px;
}
#carousel .image_text .text_background{
position:absolute;
top:0;
left:0;
height:100%;
width:100%;
background-color: rgb(0,0,0);
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=70)";
opacity: 0.7;
}
#carousel .image_text span{
display:block;
color:#FFF;
font-family: 'open_sansbold';
font-size: 300%;
text-transform: uppercase;
overflow:hidden;
}
#carousel .image_text span p{
margin:0;
}
Html HTML
<div class="image_text">
<span>
<p>This is text2</p>
</span>
<div class="text_background"></div>
</div>
You need your text to be above the background 您需要文字高于背景
Set it to position relative, and give it a z-index 将其设置为相对位置,并为其指定z-index
#carousel .image_text span{
display:block;
color:#FFF;
font-family: 'open_sansbold';
font-size: 300%;
text-transform: uppercase;
overflow:hidden;
position: relative;
z-index: 10;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.