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: Wed, 22 Nov 2006 10:18:40 -0500
Message-ID: <F09CB915-ACDB-47F5-B4F8-B3CC443275A9@michelf.com>

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
http://www.michelf.com/
Received on Wednesday, 22 November 2006 07:18:40 UTC

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