RE: CSS3 and Selectors

> -----Original Message-----
> From: www-style-request@w3.org 
> [mailto:www-style-request@w3.org] On Behalf Of Ian Hickson
> Sent: Saturday, September 07, 2002 1:56 AM
> To: Adam van den Hoven
> Cc: W3C Style
> Subject: Re: CSS3 and Selectors
> 
> 
> 
> On Fri, 6 Sep 2002, Adam van den Hoven wrote:
> > 
> > <a href="#"><span class="text">This is a link</span><img 
> > src="/img/thisisalink.gif" alt="This is a link" /></a>
> 
> That is pointless. The whole point of the alt="" attribute is 
> to include this alternate text. You don't need to explicitly 
> mention this in the stylesheet, either.

No its NOT pointless. This code would (and in fact does) appear in an
application that we host for a large number of clients. Some of those
clients have to resources to pay for customized graphics. Others don't,
or don't care. Aside from accessibility issues, my overriding concern is
with these clients. 

"But why not use JSP code to control whether graphics are displayed or
not?" you ask.

Because the group that does the development is independent of the group
that does customization. I'd really rather not have to do another
incremental release when someone decides that they'd really like to do
all the labels for form fields as graphics. I've worked very hard to
give the developers a set of HTML guidelines that allow my customizers
to do as much as humanly possible without having to produce a unique JSP
set for any given client. 

This particular construct is the most annoying piece of code in an
otherwise semantically meaningful structure. 

> > This works fine. However, either way, I'm including 
> information that 
> > is not strictly meaningful. The <span class="text"> conveys no 
> > additional information.
> 
> That is correct.

I was referring to the tag itself, not its text. 

From my point of view the Text belongs there. The image Does not. 

> > What I would like to be able to do is something like:
> > 
> > @media screen{
> >  a::text{display:none;}
> >  a {height:20px; width:200px; 
> > background-image:url(/img/thisisalink.gif);
> > }
> > 
> > @media tty,audio{
> >  a::text{display:inline;}
> > }

As David Woolley asks, no one is currently implementing this (as far as
I know) but that doesn't mean I shouldn't do it.

Again, because I have more control over the customization (which mostly
involves graphics and CSS) I can do content negotiation with my CSS by
making decisions about what to send up. Mind you, I'd be much happier if
browsers would alter their list of accepted mime type to reflect current
settings (for instance, disabling JavaScript or images should remove
those from the list of accepted mime-types). 

> > <a href="#">This is a link</a>
> > 
> > It seems (to me) to be a whole lot cleaner since I don't 
> need to add 
> > extra mark-up.
> 
> You can make the font-size be 0, which will have that effect.

This is a kludge. A very big kludge. 
 
> In CSS3 you will be able to directly change the content of an 
> element, using the 'content' property, as in:
> 
>    @media screen {
>       a { content: url(/img/thisisalink); height: 2em; width: 20em; }
>    }

Well, that makes me very happy. Perhaps that is a much better solution
than being able to distinguish the text from the tag. 

Mind you, I'm a big fan of using XPath-like selectors. 

Adam

Received on Monday, 9 September 2002 12:58:35 UTC