[whatwg] The IMG element, proposing a CAPTION attribute
James Graham
jg307 at cam.ac.uk
Wed Nov 22 07:32:35 PST 2006
Alexey Feldgendler wrote:
> On Wed, 22 Nov 2006 20:42:11 +0600, Michel Fortin <michel.fortin at michelf.com> wrote:
>
>> So I propose a new <fcaption> elements -- for "figure caption" -- in
>> replacement for the <caption> element in my previous figure construct:
>>
>> <figure>
>> <fcaption>Caption Text</fcaption>
>> <img src="...">
>> </figure>
>>
>> And if I were to propose a default styling for this, it'd be this one:
>>
>> figure { display: table; }
>> fcaption { display: table-caption; }
>
> <figure> cannot be used like this:
>
> <table>
> <thead>
> <tr>
> <th>Painting</th>
> <th>Title</th>
> <th>Author</th>
> </tr>
> </thead>
> <tbody>
> <tr>
> <td><img id="img1" src="..."></td>
> <td><label for="img1" type="title">Mona Lisa</label></td>
> <td>Leonardo da Vinci</td>
> </tr>
> ...
> </tbody>
> </table>
In general I think that having <img> and <imgcaption> (or whatever they are
called) enclosed by a single element is a better idea since the increased
simplicity makes rendering easier. For example, how would you expect a browser
to render this?:
<p>Foo
<img id="bar">
<p>Foobar
<p>Baz
<imgcaption for="bar">Pictures are nice!</imgcaption>
In all current UAs I guess it would render something like:
Foo
<img>
Foobar
Baz
Pictures are nice
But I can't think of many situations where a figure's caption should be separate
from the figure itself and, from the discussion above, it seems that some people
would expect:
Foo
<img>
Pictures are nice
Foobar
Baz
Which is hard (impossible?) to implement in legacy clients (e.g. via script, if
the DOM is to be unchanged) and harder to implement in future clients.
Another issue to consider is the possibility of multiple images with a single
caption (this is very common in scientific papers, print magazines, etc.). A
construct like
<figure>
<img>
<img>
<img>
<imgcaption>
</figure>
might be enough to support this (the details are, I think, non-trivial);
something that requires the caption to point to exactly one image cannot.
--
"Eternity's a terrible thought. I mean, where's it all going to end?"
-- Tom Stoppard, Rosencrantz and Guildenstern are Dead
More information about the whatwg
mailing list