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

Hi!

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).

Markup:
<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>

CSS:

#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 
proposed.

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

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