Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Styling li except when a parent div has specific class Reply To: Styling li except when a parent div has specific class

#234732
bouvrie
Participant

Hmmm seems my example was too basic. I was expecting a solution with the :not() selector, as my actual use case is more complex; the div class=”b” represents any li that’s not child of the class=”a” div.

This li can occur anywhere on the page, within any hierarchical depth as well. It’s never enclosed by specific elements/classes, the only quality is that I want to separate li’s that are either within an a/b class, and the rest.

I can code several lines to make this working, but IMO something this simple should be containable within a small code footprint, using the :not() selector?

See:
http://codepen.io/anon/pen/qOJwVw