[whatwg] image captions

Ben Meadowcroft ben at benmeadowcroft.com
Wed Jun 28 13:01:34 PDT 2006


> -----Original Message-----
>
> ... Snipped a bit ...
>
> > What's wrong with
> >
> > <div>
> >    <img src="">
> >    <p>This is the caption.</p>
> > </div>
> >
> 
> How about an anchor with rel="caption":
> 
> <a rel="caption" href="#caption1"><img src="x.jpg"/></a>
> <span id="caption1">man bites dog</span>
> 
> or
> 
> <img id="img1" src="x.jpg"/>
> <span id="caption1"><a rel="caption" rev="#img1">man bites 
> dog</caption></span>
> 
> The latter has the advantage that you can put another <a> 
> element around the image (HTML4 prohibits nesting iirc).
> 
> This way requires no new elements or attributes, just a new 
> LinkType[1]. Also if you define other LinkTypes, you could 
> express the other relationships Michel identified, e.g. you 
> could have a Linktype for "excerpt of an article with a> 
> small category logo at the top."

Perhaps a better method would be using the longdesc attribute to associate a
caption with an image.
Specifically we could point the image to fragment within the current page
and give an explicit association in this manner.

<img src="man.gif" alt="A Man" longdesc="#manCaption" />
<p id="manCaption">A more full description of the image</p>

Does anyone know how screenreaders and other assistive technologies handle
longdesc URIs pointing to fragments within the same page?

regards,
Ben





More information about the whatwg mailing list