W3C home > Mailing lists > Public > whatwg@whatwg.org > November 2006

[whatwg] The IMG element, proposing a CAPTION attribute

From: Michel Fortin <michel.fortin@michelf.com>
Date: Fri, 10 Nov 2006 18:39:54 -0500
Message-ID: <9BDC1D1A-81D2-4843-9833-1F83F66FBCC9@michelf.com>
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/
Received on Friday, 10 November 2006 15:39:54 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:58:49 UTC