I'm trying to understand why my two divs are not behaving as expected. I positioned one with absolute position and set the z-index to the lowest value, while the other has a higher value. However, the absolute position div always remains on top (opposite behavior).
Below is an image for reference:
https://i.sstatic.net/Wz1mh.png
Here is the code snippet:
<div style="position:relative;">
<div style="position:absolute;width:200px;background-color:#ff0;z-index:1;">
SHOULD BE ON BACK. SHOULD BE ON BACK. SHOULD BE ON BACK.
SHOULD BE ON BACK. SHOULD BE ON BACK.
</div>
<div style="width:300px;background-color:#0f0;z-index:999999;">
SHOULD BE ON FRONT. SHOULD BE ON FRONT.
SHOULD BE ON FRONT. SHOULD BE ON FRONT.
</div>
</div>
You can see the issue in action in this jsfiddle: