css - How to select all elements excluding a specific one along with all its descendants -


update: may not possible. i'm still looking solution.

i need create css selector select page elements using * exclude .exception elements along descendants (!). .exception element , descendants needs detain initial styles while * styles should applied other page elements.

important: solution not if styles applied .exception , descendants first , need override initial values manually! i don't want apply styles .exception and/or descendants @ all!

desired result

please keep in mind trivial example. page need apply solution contains more elements i need generic solution filtering elements. manual selection , overriding elements wouldn't possible there.

http://jsfiddle.net/zv5gf/2/ (initial state, no solution)

enter image description here enter image description here


solution :not selector - not perfect

this solution not enough because exclude li.exception not exclude descendants. li.exception descendants initial styles lost.

http://jsfiddle.net/zv5gf/3/

*:not(.exception){     background-color:orange !important; } 

and logical solution div.exception , descendants doesn't work (not supported browsers):

*:not(.exception *){     background-color:orange !important; } 

enter image description here enter image description here

how putting background:inherit children?

*{     background-color:white }  *:not(.exception){      background-color:red }  .exception *{     background:inherit; } 

jsfiddle


Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -