z-index when using ::after under element
If we use z-index combined with position: absolute; its possible to place the ::before of a element under itself. There is a good example on another question ( jsfiddle.net/Ldtfpvxy ). Basically <div id="element"></div> #element { position: relative; width: 100px; height: 100px; background-color: blue; } #element::after { content: ""; width: 150px; height: 150px; background-color: red; /* create a new stacking context */ position: absolute; z-index: -1; /* to be below the parent element */ } renders: So the stacking context/order is defined by z-index . But when I apply z-index: 1; to the