This does not work because you are applying a z-index to the parent element, which makes the stack of children relative to other elements inside the parent.
As soon as you assign an element a value for z-index (except auto), that element sets its own local stack context. This means that all of the descendants of an element have their own stacking order, relative to the ancestor element.
So, if the parent has z-index: 9 and the child is z-index: 8 , it kind of assigns the z-index of 9, 8
See the article here for a better explanation.
If you remove the z-index from the parent and set the sibling element to z-index: -1 , this should work. I'm not sure about all browsers, but it still works in Chrome.
Here is the updated fiddle
Hope this helps.
source share