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.


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


> 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;}
> }
> 
> <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 markup.

You can make the font-size be 0, which will have that effect.

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; }
   }

HTH,
-- 
Ian Hickson                                      )\._.,--....,'``.    fL
"meow"                                          /,   _.. \   _\  ;`._ ,.
http://index.hixie.ch/                         `._.-(,_..'--(,_..'`-.;.'

Received on Saturday, 7 September 2002 04:56:10 UTC