So I have this fiddle:
https://jsfiddle.net/ionescho/t0qo6z5u/ . With html :
<div id="overlay">
</div>
<div id="top_menu">
<span>
fasdfsfafasdfas
</span>
</div>
and css:
#overlay{
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 1100;
background-color: #000;
opacity: 0.8;
}
#top_menu{
position:fixed;
top:0;
left:0;
right:0;
height:200px;
background-color:red;
padding-top:40px;
padding-left:40px;
}
#top_menu > span{
font-weight:bold;
color:white;
font-size:30px;
z-index:1101;
position:relative;
}
As you can see, the white text is still behind the semi-transparent overlay. If I modify the span's parent (#top_menu) from "position:fixed" to "position:relative", I get the z-index behavior I was looking for.
However, I cannot lose that "position:fixed" property. Does anyone know why this happens and how can I make a work-around?
Thanks.