CSS z-index not working (position absolute) [duplicate]

Remove

z-index:0;

from .absolute.

Updated fiddle here.


This is because of the Stacking Context, setting a z-index will make it apply to all children as well.

You could make the two <div>s siblings instead of descendants.

<div class="absolute"></div>
<div id="relative"></div>

http://jsfiddle.net/P7c9q/3/