[css3-selectors] feature request

For a while now I’ve been thinking it would be extremely handy if CSS had a pseudo class which could, on being affected by the user, trigger styles on another element. It would be a lot like how you can trigger events from parent to child nodes, except with this pseudo class the element could trigger styles on any element in the document.

A syntax I think might work would be, for example:

foo:trigger(bar:hover){/* styles */}

where foo is the trigger element, bar is the element to be effected, hover is the event, and the styles are what the user sees happen to bar. So when you hover over foo, you see the styles within the block affect the element bar. If it were:

foo:trigger(baz:focus){/* styles */}

then giving foo focus would cause the styles to be applied to element baz.

I just think it’s an interesting concept (if it hasn’t already been suggested), since there’s no way in CSS to select to a parent node, but you wouldn’t need to in most style manipulation cases if you had a :trigger pseudo-class.

Tom
Cogito Studios

Received on Friday, 17 June 2011 00:00:05 UTC