[whatwg] The IMG element, proposing a CAPTION attribute
James Graham
jg307 at cam.ac.uk
Fri Nov 10 02:11:15 PST 2006
Jeff Seager wrote:
> What's clearly missing from the IMG specification is an appropriate
> means for pairing each picture or graphic with a caption. Neither ALT
> nor LONGDESC is appropriate for this. My current solution, borrowed from
> Darren Brierton of Vancouver (
> http://www.dzr-web.com/people/darren/blog/2005/02/09/image-captions-in-xhtml/
> <http://www.dzr-web.com/people/darren/blog/2005/02/09/image-captions-in-xhtml/>
> ), is to embed the image as the DT in a definition list, with the
> caption as the DD. Semantically, this makes sense because the caption
> does in fact "define" the image by adding both meaning and context for
> visual and non-visual users. But assumptions have already been made in
> the specifications about the nature of a definition list, and captioning
> was not among those assumptions, so it's a little clunky to bend the
> rules like this.
I would argue that, unless any UA does something meaningful with the
<dt><dd> pair when one is an image (unlikely since this is not an
accepted way of generating captions, but not impossible), marking up
captions in this way is no more useful than using e.g.
<div>
<img>
Caption
</div>
(I do not mean to suggest that you are using "bad markup" here; I'm just
starting to wonder, in general, whether all the discussions that people
have about the most meaningful way to markup a particular construct that
is not explicitly mentioned in the spec are actually as worthwhile as
the amount of effort that is put into them would suggest. I suspect, at
least in many cases, it is not since no UA can guess what the markup is
supposed to represent without actual AI).
> A better way would be to semantically attach the caption or cutline to
> the image itself, so its display is paired naturally. In this way, the
> width of the cutline would be dictated (unless overruled in the
> stylesheet) by the width of the image. I'm suggesting that CAPTION be
> adopted as a new attribute of the IMG element, as it is already for the
> TABLE element.
This has previously been brought up but typically as a caption element
since this would allow markup inside the caption. I (and I think others
too) agree that this is an important addition we should make to HTML.
--
"The universe doesn't care what you believe. The wonderful thing about
science is that it doesn't ask for your faith, it just asks for your
eyes" --- http://xkcd.com/c154.html
More information about the whatwg
mailing list