z-index
is not effective on elements with a static
position.
As stated on this website:
This property determines the stacking order of a box when its position value is set to either absolute
, fixed
, or relative
.
If you change your div to have a relative
position instead, you can utilize z-index
to control the layering.
position: relative
places the element in relation to its default (static) position, so if top, bottom, left, or right are not specified, there will be no distinction between static
and relative
except for the fact that relative
enables the use of z-index
to adjust the stacking order of the element.
Edit: taking into account your code snippet, here's a functional demo found at this link.
Edit 2: another suggestion from Nathan D. Ryan in the comments suggests applying a negative z-index
to your absolutely-positioned div. This action would push it behind any other content on the page lacking a lower defined z-index
.