W3C home > Mailing lists > Public > www-style@w3.org > December 2005

Redo selectors instead of parent-selectors

From: Jesper Hermansen <hermandsen@vip.cybercity.dk>
Date: Wed, 21 Dec 2005 11:52:27 +0100
Message-ID: <43A933EB.4040208@vip.cybercity.dk>
To: www-style@w3.org


I've been reading the archives about parent-selectors, and the problems 
that seem to be with them when going up the tree.

Instead of doing a parent-selector, how about a new selector!

A quick example.
Say I want to show/hide an html-<img>, when hovering different links.

I'm using a slash (/) for doing a new selector (maybe someone can think 
of a better character).

<img id="logo" src="foo/bar.png" alt="foobar" />
<a href="http://www.google.com/">Google</a>
<a href="/examples/">Site examples</a>
<a href="http://w3.org/">W3</a>


#logo {
	visibility: hidden;

a[href^="http://"]:hover / #logo {
	visibility: visible;

The selector above would first evaluate hover on the link and, if true, 
continue to the #logo-selector, and apply the visibility-style.

What I would like to see, is when then hover-event occurs on the anchor, 
the image should vi visible. I know it's easier to put the image after 
the anchors, but that's not the point of the selector.

I hope you get the idea, and that something similar hasn't already been 

Jesper Hermansen
Received on Wednesday, 21 December 2005 11:44:20 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:27:22 UTC