Let's say that i have this HTML file:
<div> class="parent-x">_</div>
<div> class="parent-x">_</div>
<div> class="parent-x">_</div>
<div> class="parent-x">
<div> class="some-child"> A child </div>
</div>
I want to style "parent-x" who is the direct parent to class "some-child". (without using Has since it's not supported in all browsers)
what i have tried is:
.parent-x > .some-child {
display: flex;
align-items: center;
}
but this styles the child itself not the parent.
I tried using "!" to select which class to be styled:
.parent-x! > .some-child {
display: flex;
align-items: center;
}
But I guess it is not supported anymore
Also I tried:
.some-child < .parent {
display: flex;
align-items: center;
}
But it gives me syntax error in my editor.