See http://jsfiddle.net/uR5MS/1/
You must make three divs in the same stacking context. Unsurprisingly, your code could make the blue div taller than everyone else, as it is nested in a higher div.
body {margin-left:10px;} #top {background:blue;width:30px;height:30px;position:absolute;bottom:0;z-index:3;top:70px;} button {margin-top:200px} #back {width:100px;height:100px;background:red;position:absolute; z-index:1} #front {width:100px;height:100px;background:green;position:absolute;top:50px; z-index:2;}
You will need to reverse engineer CSS, since divs are now absolute and are on the same stacking level. See that z-index now saved after conversions.
Niloct
source share