Is it possible to apply certain CSS to any element, except descendants of a certain class?
Here's a fiddle: http://jsfiddle.net/68jgdthm
As you can see I want everything on the page to be dark except elements which are descendants of the light class. The trick here is that one can't know if the element is a direct descendant, e.g. it might be this:
<div class="light">
<p>Element</p>
</div>
but it might also be this:
<div class="light">
<div>
<div>
<p>Element</p>
</div>
</div>
</div>
The dark class is almost always added to the body element and will always be a parent of any light classes.
One might say:
Just make the body "light" and add
darkclasses to any elements you need. - But I actually need the opposite, I need everything to bedarkand certain elements to belight.Then add "light" styles and add the
lightclass to elements you need. - I already have thedarkstyles, so I'm looking for an easier "excluding" solution (I'm using LESS, so prefixing etc. is quite easy).