Donny P Donny P - 1 month ago 7
CSS Question

Make a fixed position element appear behind a static position element

How can you make an element that has a

position: fixed
display behind an element with
position: static
? Changing z-index doesn't seem to matter since they are not absolute.

K3N K3N
Answer

You can use negative z-index on the fixed element.

<div id="fixed">This is fixed</div>
<div id="static">This is static</div>

#fixed {
    position:fixed;
    z-index:-1;
}

Fiddle Demonstration