[whatwg] The IMG element, proposing a CAPTION attribute

Michel Fortin michel.fortin at michelf.com
Wed Nov 22 07:18:40 PST 2006

Le 22 nov. 2006 à 9:53, Alexey Feldgendler a écrit :

> 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:
> [...]

Indeed, <figure> markup cannot express a full table -- but it doesn't  
need to. Following CSS 2.1 [1], anonymous boxes are created for rows  
and cells wherever appropriate. In the previous example, an anonymous  
row and an anonymous cell are created to hold the content of the  
figure. The figure effectively behave visually as a one-cell table  
with a caption.

  [1]: http://www.w3.org/TR/CSS21/tables.html#anonymous-boxes

It works pretty well in browsers that implement `display: table`. And  
a not-so-bad fallback for browsers that do not implement the CSS  
table display model (IE) is to display both <figure> and <fcaption>  
as blocks, setting the width explicitly for floated figures (so that  
the caption does not extend the box horizontally).

Michel Fortin
michel.fortin at michelf.com

More information about the whatwg mailing list