RE: [techs] text euiqvalents in links

Chaals asked: 

> When an IMG is used as an anchor, you've got to have a text 
> equivalent. But what's the best way to implement the text equivalent?
> 
> Within the anchor:
> <a href="cats.html"><img src="cat.jpg" alt=""/>cats</a>
> 
> Alt text:
> <a title="cats" href="cats.html"><img src="cat.jpg" alt="cats"/></a>
> 
> Title on anchor:
> <a title="cats" href="cats.html"><img src="cat.jpg" alt=""/></a>
> 
> Title on IMG:
> <a href="cats.html"><img src="cat.jpg" alt="" title="cats" /></a>
> 
> Using all 4:
> <a title="cats" href="cats.html"><img src="cat.jpg" 
> alt="cats" title="cats"
> />cats</a>

I want to split your question in two parts: 
* What should be the content of the anchor (image or image with text)?
* Where should title-attributes be used?

* What should be the content of the anchor (image or image with text)?

I think that in practice, the context will help the author decide whether to
use text inside the anchor as well as the image. I think that looking at the
'click target' in visual browsers gives you a good clue. For example: if the
image is merely decorative, for example an arrow before the link text, then
you will have an image and text side by side. You want to have both the
arrow and the link text clickable, so both would be inside the anchor. If
the image itself is the clicktarget, for example in a graphical menu, you
will not use separate link text. 

That gives two options for the contents of the anchor, which will depend on
the context:
<a href="cats.html"><img src="arrow.gif" alt="" />Cats</a>
<a href="cats.html"><img src="cats.jpg" alt="cats" /></a>

Adding text inside an anchor just to create a text equivalent feels
artificial to me, especially if you then use CSS to make it invisible in
visual user agents. 

* Where should title-attributes be used?

According to the HTML specs, the title attribute should be used for advisory
information about the element for which it is set. In my interpretation,
this means it should not be used for required information such as an
alt-text. It should be used for additional information, not for required
information. Whether a title is appropriate is up to the author. I would put
a title on the <a> if I wanted to explain something about the linked
content, and on the img if I wanted to give additional information about the
image. 

Yvette Hoitink
Heritas, Enschede, the Netherlands
E-mail: y.p.hoitink@heritas.nl

Received on Tuesday, 30 March 2004 02:47:59 UTC