Imagine the following scenario:
<div id="one"/>
<div id="two">
<div id="three"/>
</div>
<div id="four"/>
I am trying to apply a pseudoelement to three that appears behind it but in front of two (and any other ancestors if applicable). The challenge lies in the fact that I am working within a UI framework that automatically generates HTML and CSS, making it impossible to tailor a solution for this specific case alone—it must function universally. Assuming that one, two, and four are absolutely positioned, while three and its pseudoelement may have different position values as long as they act correctly.
Initially, using z-index -1 on the pseudo seemed promising locally, however, it ended up appearing behind two. I attempted to address this by creating a new stacking context on three through setting its z-index to 0, but encountered unexpected behavior. It seems like my understanding of stacking contexts might be flawed.
In case you're curious about the underlying goal, I am striving to incorporate support for rounded gradient borders into the framework.