css ::before behind element code example
Example: css before behind element
.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;
}