<div class="parent">
<div class="child"></div>
</div>
.parent {
width: 100px;
height: 100px;
background: green;
position: relative;
z-index: 100;
}
.child {
position: relative;
z-index: 90;
}
.child:before {
content: "";
position: absolute;
background: red;
width: 50px;
height: 50px;
top: 60px;
left: 60px;
z-index: 10;
}
.parent {
width: 100px;
height: 100px;
background: green;
position: relative;
overflow: hidden;
}
.child {
position: relative;
z-index: -1;
}
.child:before {
content: "";
position: absolute;
background: red;
width: 50px;
height: 50px;
top: 60px;
left: 60px;
z-index: 10;
}