I have a div
with default positioning (i.e. position:static
) and a div
with a fixed
position.
If I set the z-index
Give the #under
a negative z-index
, e.g. -1
This happens because the z-index
property is ignored in position: static;
, which happens to be the default value; so in the CSS code you wrote, z-index
is 1
for both elements no matter how high you set it in #over
.
By giving #under
a negative value, it will be behind any z-index: 1;
element, i.e. #over
.