I am reviewing the stack context concept and am confused about the following example
In the parent div, we create a new stack context and I do not understand why the child stack above the parent div, I am also using this image as a reference
.
.parent {
width: 200px;
height: 100px;
background: #168bf5;
position: relative;
/* Generate new stacking context */
z-index: 1;
}
.child {
width: 100px;
height: 200px;
background: #32d19c;
z-index: -1;
}
<div class="box">
<div class="parent">
parent
<div class="child">child</div>
</div>
</div>