Say I have the following HTML:
.wrapper {
position: relative;
z-index: 99;
}
.red, .green {
position: absolute;
top: 0;
left: 0;
width: 100px;
height: 100px;
}
.red {
background: red;
z-index: 400;
}
.green {
background: green;
}
<div class="wrapper">
<div class="red"></div>
</div>
<br>
<div class="wrapper">
<div class="green"></div>
</div>
I would like the red box to appear on top of the green box. But it doesn't. The .wrapper
has z-index
of only 99
whereas .red
has z-index: 100
. Are there any hacks top produce .red
on top?
Thanks in advance!