Alternate nesting styles

edited February 2007 in Style Development
data:text/html;charset=utf-8;base64,PCFET0NUWVBFIGh0bWwgUFVCTElDICItLy9XM0MvL0RURCBYSFRNTCAxLjAgU3RyaWN0Ly9FTiIgImh0dHA6Ly93d3cudzMub3JnL1RSL3hodG1sMS9EVEQveGh0bWwxLXN0cmljdC5kdGQiPg0KPGh0bWw%2BDQo8aGVhZD4NCg0KPHN0eWxlIHR5cGU9InRleHQvY3NzIj4NCg0KdWwgew0KICBib3JkZXI6IDFweCBzb2xpZCBibGFjazsNCiAgcGFkZGluZzogMWVtOw0KICBiYWNrZ3JvdW5kLWNvbG9yOiBsaWdodGdyZWVuOw0KfQ0KDQp1bCB1bCB7DQogIGJhY2tncm91bmQtY29sb3I6IGxpZ2h0eWVsbG93Ow0KfQ0KDQo8L3N0eWxlPg0KDQo8c2NyaXB0IHR5cGU9InRleHQvamF2YXNjcmlwdCI%2BDQoNCi8vIHRlc3RzDQpmdW5jdGlvbiB0ZXN0KCkgew0KICAvLyBnZW5lcmF0ZSBzcGVjaWZpZWQgbGV2ZWwgb2YgbmVzdGVkIGxpc3RzDQogIHZhciBzdHIgPSAiVGhlcmUgb3VnaHQgdG8gYmUgYSBzaW1wbGUgd2F5IHRvIGFsdGVybmF0ZSB0aGUgY29sb3JzLiI7DQogIGZvcih2YXIgaSA9IDA7IGkgPCAxMDsgaSsrKSB7DQogICAgc3RyID0gIjx1bD48bGk%2BIiArIHN0ciArICI8L2xpPjwvdWw%2BIjsNCiAgfQ0KICBkb2N1bWVudC5ib2R5LmlubmVySFRNTCA9IHN0cjsNCn0NCg0Kb25sb2FkID0gdGVzdDsNCg0KPC9zY3JpcHQ%2BDQoNCjwvaGVhZD4NCjxib2R5Pg0KDQoNCjwvYm9keT4NCjwvaHRtbD4NCg%3D%3D

On this page, I have 10 nested ul lists generated by script. I'm trying to find a way to make the colors alternate every two nested levels, i.e. every other ul list should be yellow and the rest green.

I noticed that the default bullets for lists do not alternate every 3 levels, but continue forever with square bullets. I wonder, is this nested styling is possible at all?

Comments

  • ul, ul ul ul, ul ul ul ul ul, ul ul ul ul ul ul ul, ul ul ul ul ul ul ul ul ul { background-color: lightyellow !important; } ul ul, ul ul ul ul, ul ul ul ul ul ul, ul ul ul ul ul ul ul ul, ul ul ul ul ul ul ul ul ul ul{ background-color: lightgreen !important; }
Sign In or Register to comment.