The Green
span text should be over the blue box.
I don't know why it is not working, even z-index
for Green
span is higher than the blue box.
.green, .blue {
position: absolute;
width: 100px;
color: white;
line-height: 100px;
height: 100px;
text-align: center;
}
.green {
top: 60px;
left: 60px;
background: green;
z-index: 1;
}
.green span {
z-index: 3;
}
.blue {
top: 100px;
left: 100px;
background: blue;
z-index: 2;
}
<div class="green">
<span>Green</span>
</div>
<div class="blue">
<span>Blue</span>
</div>
Expected result is below;
How can I make Green span is over the blue box?