W3C home > Mailing lists > Public > www-style@w3.org > April 2007

Re: Select a parrent node with s CSS selector?

From: Daniel Beardsmore <public@telcontar.net>
Date: Wed, 25 Apr 2007 01:56:05 +0100
Message-ID: <462EA725.5010600@telcontar.net>
To: www-style@w3.org

James Craig wrote:
> Daniel Beardsmore wrote:
> 
>> I'm curious thus to know precisely *why* a parent node selector is  
>> so important? What would it solve that cannot be solved with  
>> existing CSS2 or CSS3 selectors?
> 
> Interaction design. The first example that comes to mind is, if you  
> mouse over a link in a paragraph or other section, you could dim the  
> paragraph to make the link stand out instead of changing the link...

Hm ... to me, that would be a bit iffy, as you'd be causing a disconcerting 
visual change on the whole page that could be confusing. It would also manifest 
itself as a page that flickers crazily as you move the mouse across links on the 
way to some part of the screen.

One example where it might help is, for example:

  <ul class="navigation">
   <li><a href="...">Some link</a></li>
   ...
  </ul>

You might want the background or border around the anchor -- often applied to 
the <li> -- to change when you put the cursor over the anchor.

But you can simply style the anchor as display: block and give it any borders, 
background image etc and use .navigation a:hover to do mouse-over effects 
without needing to select the <li> containing the anchor as well.
Received on Wednesday, 25 April 2007 00:57:55 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:54:50 GMT