[whatwg] image captions

Michel Fortin michel.fortin at michelf.com
Tue Apr 4 20:20:02 PDT 2006


Le 4 avr. 2006 à 21:13, Lachlan Hunt a écrit :

> Ian Hickson wrote:
>> On Tue, 4 Apr 2006, fantasai wrote:
>>> I'm wondering what WA1 considers appropriate markup for a figure  
>>> with a caption.
>>    <p><img src="image-equivalent-of-text" alt="text"  
>> title="caption"></p>
>
> That's fairly limited because it doesn't allow markup within the  
> title attribute.  What about extending the <caption> element,  
> currently used with <table>, to <img>, <object> and <embed>?

Something like this?

     <figure>
       <img src="...">
       <caption>Some image found <a href="...">here</a></caption>
     </figure>

I think it's a great idea, but there is a backward-compatibility  
problem: current HTML parsers just ignore the caption element when  
outside a table; you can't style it and it probably is absent from  
the DOM too. Parsing it as XML works, but then the default style  
isn't pretty at all. Here are my two (unstyled) test cases which I  
have tested using WebKit and Gecko:

<http://www.michelf.com/docs/figure.html>
<http://www.michelf.com/docs/figure.xml>


Michel Fortin
michel.fortin at michelf.com
http://www.michelf.com/





More information about the whatwg mailing list