[whatwg] The IMG element, proposing a CAPTION attribute

Michel Fortin michel.fortin at michelf.com
Fri Nov 10 15:39:54 PST 2006


Le 10 nov. 2006 à 14:19, Alexey Feldgendler a écrit :

> On Fri, 10 Nov 2006 23:47:05 +0600, Steve Runyon  
> <s.runyon at gmail.com> wrote:
>
>> Couldn't we extend the <label> element to work for images as well  
>> as form
>> elements?  The for attribute would provide the explicit link to  
>> the image
>> that would take the label's contents out-of-stream for screen  
>> readers, and would likewise (with some CSS changes, I suppose)  
>> allow the caption to be
>> positioned correctly relative to the image for visual browsers.
>
> Today's browsers seem to have problems about <label> outside of  
> <form>.

And today's browsers also have problems with <caption> outside a  
table, which implies that my previously proposed markup for this:

     <figure>
       <caption>caption text</caption>
       ... figure content here ...
     </figure>

would not work correctly in today's browsers. But if you look at  
things in another way, today's Firefox can't handle <section>,  
<aside>, <header>, and <footer>  correctly either (stopping the  
section at the first block-level element!). So it seems that Web  
Applications 1.0 already requires browser vendors to do some minor  
changes to the DOM unknown markup created previously; maybe  
supporting <caption> or <label> could be part of these changes.

Also, the last versions of Safari and Opera work fine with <section>,  
but that's relatively new because not so long ago they couldn't.  
Should we take this as a sign that browser vendors are willing to do  
the necessary changes to work with the new elements? Could such  
changes be extended to <caption> or <legend>?

What I like about the figure markup above is that it can be styled in  
the same way as a table:

     figure  { display: table; }
     caption { display: table-caption; }

which makes <figure> behave as a one-cell table, and <caption> behave  
as the caption for that table (and you can play with `caption-side:  
bottom` too). The only problem is that it doesn't work presently  
because <caption> is completely ignored when outside a table.


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





More information about the whatwg mailing list