<div class="first">
<div class="second"></div>
</div>
<div class="third"></div>
div {
width: 50px;
height: 50px;
position: absolute;
}
.first {
top: 0;
background: #08ff23;
z-index: 1;
display: contents;
}
.first::after {
content: '';
position: inherit;
z-index: inherit;
top: inherit;
width: inherit;
height: inherit;
background: inherit;
}
.second {
top: 20px;
background: #ce1248;
z-index: 3;
}
.third {
top: 40px;
background: #2235ac;
z-index: 2;
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.