Given the sample below, how do I select all p
that do not have any descendants with the avoid
class?
<div class="avoid">
<div>
<p>I don't want to style this one</p>
</div>
</div>
<div>
<div>
<p>Style only this one</p>
</div>
</div>
I tried :not(.avoid) p
, but it doesn't work because some descendants of p
don't have the avoid
class, which is expected in my codebase.
I can't use :has