I have two elements as parent and child and I want to make the child element to go behind the parent element. I try to add z-index:-1 to child element but nothing happens ... can someone guide me on how to make the child go behind parent element.
.parent {
width: 200px;
height: 200px;
border-radius: 50%;
background-color: coral;
color: white;
font-size: 25px;
text-align: center;
line-height: 200px;
cursor: pointer;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.child {
position: absolute;
top: 50%;
left: 50%;
width: 200px;
height: 200px;
border-radius: 50%;
background-color: silver;
z-index: -1;
}
<div class="parent">
parent
<div class="child">child</div>
</div>