I try to get familiar with the different positioning attributes and the z-index. While playing around I noticed that child elements are covering the parent element even if the parent has a z-index of 1:
div {
width: 200px;
height: 200px;
}
.red {
background-color: red;
position: absolute;
}
.blue {
background-color: blue;
position: absolute;
left: 1877px;
}
.yellow {
background-color: yellow;
}
.white {
background-color: white;
position: absolute;
left: 650px;
z-index: 1;
}
<div class="white">
<div class="red"></div>
</div>
<div class="blue"></div>
<div class="yellow"></div>
So the div element with the class "white" is covered by the "red" div despite a z-index of 1... Could anyone please explain me the behavior?