tags:

views:

30

answers:

2

how to set the zindex value of the child div's greater than parent div. where parent zindex differs.

+2  A: 

Positioning contexts nest. A descendant div's z-index only has to be higher than other descendant divs in the same positioned ancestor in order for it to appear on top. A positioned child will appear on top of the positioned parent even if it has a lower z-index.

At no time is it necessary for an element to know about its positioned-ancestor's z-index.

bobince
+1  A: 

If you really want to know how to do this...

node.style.zIndex = node.parentNode.style.zIndex + 1;

node is the child div.

Thomas F.
This will only work if `parentNode` sets its z-index in a style attribute.
Zack
incase what would be if i'm unable to access the parent node's div
laki