css before element behind parent code example
Example: css pseudo element behind parent
.container {
position: relative;
z-index: 1;
}
.parent {
position: relative;
width: 200px;
height: 200px;
background: pink;
/* No z-index allowed! */
}
.parent:before {
position: absolute;
width: 200px;
height: 200px;
left: 10px;
top: 10px;
z-index: -1;
}