Imagine I have this snippet of HTML
.A {
border: thick blue solid;
}
.B {
border: medium red solid;
}
<div class="root">
<div class="A">
<div class="B">
DON'T SELECT ME
</div>
</div>
<div class="B">
SELECT ME
</div>
<div class="A">
<div class="C">
<div class="B">
ALSO DON'T SELECT ME
</div>
</div>
</div>
</div>
If I want to change the background color to yellow of the "SELECT ME" div only, how can I achieve that without affecting the other elements? I thought it could be done like this:
.root>:not(.A) .B { background: yellow; }
However, this doesn't seem to work and I am not sure why. My searches online haven't provided a solution either. Is it possible to accomplish this with CSS?