[whatwg] image captions
michel.fortin at michelf.com
Tue Jun 27 07:50:36 PDT 2006
Le 27 juin 2006 à 6:00, dolphinling a écrit :
> What's wrong with
> <img src="">
> <p>This is the caption.</p>
> ? 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?
I think something like:
<p>This is the caption.</p>
would already be more appropriate than what you suggested as it
removes the paragraph from the main flow of the document and thus
implicitly link it with the image.
But I think illustrative figures sould be disambiguated a little
more, as they are not always appropriate as asides in the sense of
"tangentially related to the content around", they are usually tied
to the content, they're not really "separate from that content".
- - -
This construct is common enough if you follow news sites. Here is my
morning harvest of a couple of use cases in the news:
Such image captions are also widely used in many publications in the
scientific and technical fields to denote figures (hence the <figure>
element I proposed on May 3):
There is a lot of figures in computer technology articles too:
This one is about strings figures:
And image captions are an integral part of Wikipedia as you can see
on many pages:
Currently, most people use either <table> or <div class="..."> or
simply put the image inside a paragraph, each option either conveying
a wrong meaning or being ambiguous with the rest of the content.
An interesting analysis has been done on the subject by Dan Cederholm
in one of his SimpleQuiz. His conclusion:
"So in this case, I might choose option A -- because visually it
shows the relationship between the items better than the others. But
I suppose this is bad semantics. Or maybe just another case where we
don't have the 'perfect' set of defined elements for this (very)
And his option A was <p><img scr="..."><br /> Caption Text</p>. In
other word, he could not figure out anything good using current
elements available in HTML, and, as most people probably do, he had
to create his own solution.
By setting a standard for such things, an explicit association
between the caption and the illustration would help image search
engines, it could enable the automatic creation of a figure index for
a page and the creation of assistive tools capable of handling
illustrations better. I think the use case is huge.
michel.fortin at michelf.com
More information about the whatwg