kiwi1342
kiwi1342

Reputation: 1389

z-index in nested div

I have the following problem:

I have 3 divs which 2 have position:fixed; but, since they are not on the same DOM level, the z-index doesn't work-

Please see

http://jsfiddle.net/hCFzS/

I am trying to move the red div on top of everything but it doesn't work. Can you help me?

Thanks

Upvotes: 1

Views: 189

Answers (3)

Ram
Ram

Reputation: 41

Update the html as

<div id="nav"></div>
<div id="container">
    <div id="div1"></div>
    <div id="div2"></div>
</div>​

Upvotes: 2

Alexander Wigmore
Alexander Wigmore

Reputation: 3186

jsfiddle Fixed it for you.
Adding top:0 and left:0 will position to left and top of the whole body. Also closed your div properly of the nav element.

Upvotes: 1

Deep Frozen
Deep Frozen

Reputation: 2075

The div wasn't closed properly. You forgot an >

Result: jsFiddle. Now it's on top.

Upvotes: 5

Related Questions