W3C home > Mailing lists > Public > www-style@w3.org > August 2004

RE: Nested and non-nested elements: pseudoclasses

From: David Zülke <dz@bitxtender.net>
Date: Thu, 19 Aug 2004 18:33:48 +0200
To: "'ACJ'" <ego@acjs.net>, "'W. Leon Sutton, Jr.'" <wsuttonjr@hyponiqs.com>
Cc: <www-style@w3.org>
Message-ID: <E1Bxprt-0002Nt-Cq@frink.w3.org>

What he wants is kind of a reference to other elements inside a selector. 

Another example (I wanted to suggest this in a post to the list but forgot):
I have styled my links to have
border-bottom:1px dotted #F00;
But when I place an image inside my link, I don't want the border to appear
(or maybe I want a border all around the image, not only border-bottom). 
I cannot do this with CSS without using classes for the links where the
image is placed inside.

If it was possible, we could do not only this, but also what Leon proposed
(as a side-effect though). The problem is to find a good syntax for this.
But if you ask me, this is DEFINITELY something that CSS needs. Imagine the
average author writing an article in his CMS'S WYSIWYG editor. He would have
to assign a class to a link if he places an image inside. Not good...

	David


> -----Original Message-----
> From: www-style-request@w3.org [mailto:www-style-request@w3.org] On Behalf
> Of ACJ
> Sent: Thursday, August 19, 2004 12:32 PM
> To: W. Leon Sutton, Jr.
> Cc: www-style@w3.org
> Subject: Re: Nested and non-nested elements: pseudoclasses
> 
> 
> W. Leon Sutton, Jr. wrote:
> 
> >It occurs to me that there is a potential 'flaw' in CSS in regards to the
> >:hover and other associated psuedoclasses.  The problem I've come accross
> is
> >non-nested elements not being capable of responding to other elements
> when,
> >per se, hovered.
> >
> >Take the following example:
> >
> ><p><a class="hovered" href="#">Hover me!</a></p>
> ><p>This is just some filler text to lead by my example.  What will follow
> is
> >another element (DIV) that should respond to the <a class="hovered">
> element
> >when it's hovered over.</p>
> ><div class="responder">I should show and hide whenever the <a
> >class="hovered"> is hovered and non-hovered.</div>
> >
> >Logically speaking, there should be a way to target an element *anywhere*
> on
> >a page using CSS psuedoclasses, such as
> >
> >a.hovered:hover ~ div.responder { display: block; }
> >a.hovered ~ div.responder { display: none; }
> >
> >Why is it that this is not possible?  As I understand it, CSS is supposed
> to
> >be a cross-platform, accessible replacement to JavaScript and DHTML.
> Yet,
> >simple tasks as this are not possible as they should be.  *However*, it
> is
> >possible to apply the same logic to nested elements, but it still
> requires a
> >fair amount of CSS.
> >
> >Anyway, this was just a thought.
> >
> >Thanks,
> >Leon Sutton.
> >
> >
> >
> CSS, by no means, is supposed to be a replacement for ECMAScript
> (standardized JavaScript), though--granted--it *is* part of DHTML (which
> is not a standard, but rather a loose collection of technologies
> commonly used for dynamic web pages).
> Some (including myself) question whether pseudo-classes that are
> "triggered" by user action should even be part of the CSS specs, as it
> seems to be more on the behaviour than the style (appearance) layer, and
> therefor actually *should* be handled by a scripting language like
> ECMAScript.
> I see the :hover pseudo-class as a nice bonus, that lacks flexibility
> but surely makes our (web designers) lives easier. If you *do* want full
> control over actions that are triggered by user input, take it to the
> (proper) behaviour layer.
> 
> By the way, how does your example not work?
> 
> Sincerly,
> 
> 
> -ACJ
> 
> >
> >
> >
Received on Thursday, 19 August 2004 16:34:25 GMT

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