This seems to be a brainer, but I'll give it a try:
I have a nested element that is position:fixed
(.inside) inside another element (.bottom) which is fixed as well and has overflow:hidden
. I need to get the nested element get out the hidden one AND overlapping another element (.top) with an higher z-index as the parent element. This means: .inside should overlay everything.
Unfortunatly I cannot change the HTML scope nor the z-index
values of .top and .bottom. And of course not the overflow: hidden
…
Here's the markup:
<div class="header">
<div class="top"></div>
<div class="bottom">
<div class="inside"></div>
</div>
</div>
… and the CSS:
body {
margin: 0;
padding: 0;
}
.header {
position: relative;
z-index: 1;
}
.top {
background: aqua;
height: 40px;
opacity: 0.5;
position: fixed; /* important – do not change! */
width: 100%;
z-index: 5; /* important – do not change! */
}
.bottom {
background: green;
height: 40px;
overflow: hidden; /* important – do not change! */
position: fixed; /* important – do not change! */
top: 40px;
width: 100%;
z-index: 3; /* important – do not change! */
}
.inside {
background: red;
height: 40px;
position: fixed; /* important – do not change! */
top: 20px;
width: 100px;
z-index: 10; /* doesn't work! */
}
Here's the fiddle: http://jsfiddle.net/c7qqtu95/1/