Suppose I have the following HTML Code
HTML
<div class="a">
<div class="b">
<div class="c"></div>
</div>
</div>
CSS
.a, .b, .c {
width: 100px;
height: 100px;
position: relative;
}
.a {
background: red;
z-index: 999;
}
.b {
background: green;
margin: 40px;
z-index: 500;
}
.c {
background: gray;
margin: 40px;
z-index: 100;
}
Now, i want it to be exactly opposite i.e, red on top of all.
I tried using z-index with position set to relative
but it doesn't work.
Here's the jsfiddle demo