Re: Select a parrent node with s CSS selector?

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 UTC