I’m currently trying to position some DIVs in a specific order using z-index but they don’t seem to be budging ive set it up in jsfiddle for you to have a look at to see if you can see any issues.
Here’s the order I’d like it to be from back to front:
RED
GREEN
BLUE
YELLOW
HTML
<div id="green">
<div id="yellow">
</div>
<div id="red">
</div>
</div>
<div id="blue">
</div>
CSS
#green{
background-color:green;
height:100px;
width:100%;
position:fixed;
top:0;
}
#red {
margin:-85px auto 0;
width:406px;
height:60px;
background-color:red;
z-index:-99999;
}
#blue{
margin:350px auto 0;
width:60px;
height:465px;
z-index:99999;
background-color:blue;
}
#yellow {
margin:0px auto 0;
width:170px;
height:170px;
background-color:yellow;
z-index:99999;
}
You have to set a position in order for z-index to work. Add position relative to the ones that don’t have it. Also don’t have the same z-index for blue and yellow or it won’t know which one to pick.
http://jsfiddle.net/SzxT2/1/