[kwlug-disc] CSS: varying colours based on inheritance

Paul Nijjar paul_nijjar at yahoo.ca
Wed Jul 6 18:07:44 EDT 2011


I can't find the right terminology to use in websearches for this, so I turn to 
you smart people (CSS is FLOSS, right?). Say I have a deeply nested list that I 
would like to style with CSS: 


- Level 1, item 1
- Level 1, item 2
  + Level 2, item 2.1
  + Level 2, item 2.2
    * Level 3, item 2.2.1
    * Level 3, item 2.2.2 
  + Level 2, item 2.3
- Level 1, item 3
   + Level2, item 3.1

The list could be pretty deep (not arbitrarily so, but deep all the same). 

Say I use CSS to set the top level colour. Is there a way for me to 
programmatically define the second level's colour based upon the parent level? 
So items at level 2 are 10% more green, and items at level 3 are 10% more green 
than those at level 2? Or am I stuck with setting colours at each individual 
level?

- Paul 




More information about the kwlug-disc mailing list