:nth-child for all descendants
I'm looking for a clever trick to select elements either strictly by their nesting depth, or by both ordinal position and nesting depth. In other words, increment n for each nth descendant of an element (or even nth-of-type) rather than just siblings. In the above example I tried and failed to get that RGB sequence to work across depths.
I've run across this problem a few times. One practical application might be to alternate between horizontal and vertical CSS menus for odd and even submenus by selecting a ul by nesting depth. I attempted this for a CSS menu but it didn't quite work. http://smorgbox.dyndns.org/tests/genmenu.html (structure comes from the HTML tree and otherwise uses generated content / counters... fails hilariously in IE of course.)
(first post, hi) :D