Parent Combinator / Parent pseudo-class

For a long time I have hoped for such a thing and still in the css3 
draft there doesn't appear to be any such function.

My concept is that it should be possible to target an element with 
specific children. This would be useful for situations such as:

a:hover < li to target an li element with an a child that has :hover

or

textarea < div < fieldset to target a fieldset that contains a text area 
inside a div

Obviously the reverse declaration style is odd, however it would seem to 
be less confusing, consider the above written in source order

fieldset < div < textarea would be targeting the first element rather 
than the last.

Another, probably better, option would be to use a pseudo-class:

fieldset:with-child(textarea)

Or more complex statements may be contained within the with-child 
pseudo-class:

ul:with-child(ul a:hover) would target a list containing a list with an 
a in :hover state.

At the very least it would make it possible in many situation to reduce 
the use of class and id attributes in your html.

Received on Monday, 21 July 2008 08:07:41 UTC