I would like to style a class based on another class not existing in the ancestors.
div:not(.evil-class) .element {
background-color: green;
}
<div class="evil-class">
<div class="element">An element within the evil class</div>
</div>
<div class="element">An element NOT in the evil class</div>
Not sure why that doesn't work?
I'm aware I can do the inverse; apply a style to both elements and then overwrite that style, but I'd rather not do that as I'd be overwriting styling which could change in a third party lib.
Thanks.