[whatwg] image captions

On 6/27/06, Michel Fortin <michel.fortin at michelf.com> wrote:
> Le 27 juin 2006 ? 6:00, dolphinling a ?crit :
>
> > What's wrong with
> >
> > <div>
> >   <img src="">
> >   <p>This is the caption.</p>
> > </div>
> >
> > ? That's how I think of it semantically, and I don't see it as
> > being common enough to warrant a separate element of its own.
>
> The problem is that this means nothing. The paragraph could be the
> caption as much as it could be an the excerpt of an article with a
> small category logo at the top, or it could be an image inserted for
> presentational purpose or something else. There is no way to
> disambiguate any of this with your markup. The fact that they are
> together does not mean that it is a caption, it somewhat convey that
> the two are related, but in what way?



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

Hugh

[1] http://www.w3.org/TR/xhtml-modularization/abstraction.html#dt_LinkTypes

Received on Wednesday, 28 June 2006 08:47:13 UTC