[whatwg] The IMG element, proposing a CAPTION attribute

Alexey Feldgendler alexey at feldgendler.ru
Wed Nov 22 09:35:49 PST 2006


On Wed, 22 Nov 2006 21:32:35 +0600, James Graham <jg307 at cam.ac.uk> wrote:

> 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

This is exactly how I expect the above markup to be rendered. Unless the  
<imgcaption> is taken out of the flow by specifying display:tooltip, it  
should show where it's written. In fact, the difference between  
<imgcaption> and <div> is no more than between <address> and <div>:  
<imgcaption> is technically the same as <div> but conveys semantical  
meaning that its content is a title for image #bar.

> 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

No, I don't expect this. If the author wanted this, he would have written  
<imgcaption> right after <img>.

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

I'm thinking of <label type="title"> as of just a fancy replacement for  
the "title" attribute. In your example, I would write:

<div id="fig1">
   <img>
   <img>
   <img>
</div>
<label for="fig1" type="title">...</label>

...probably using something more specific than <div> to group the <img>  
elements.


-- 
Alexey Feldgendler <alexey at feldgendler.ru>
[ICQ: 115226275] http://feldgendler.livejournal.com



More information about the whatwg mailing list