I am having an issue getting my pseudo element to go behind its parent element. I need the red box to go in front of the blue box.
#mobile-nav-icon {
position: absolute;
display: block;
height: 92px;
width: 93px;
background-color: red;
right: 16px;
top: 46px;
z-index: 2;
}
#mobile-nav-icon:before {
content: '';
top: -9px;
left: -10px;
background-color: blue;
height: 93px;
width: 97px;
position: absolute;
z-index: -1;
}
<div id="mobile-nav-icon">
<p>menu</p>
</div>
The result is weird, the text goes in front of the pseudo element but the background of the parent does not.
Any ideas?