Re: [CSS21] table-caption width

On 06/14/2010 03:51 PM, fantasai wrote:
> So the spec currently says that the anonymous table box (the table caption's
> containing block) has the same width as the border box of the table.
> Unfortunately, this causes the table caption to overflow in cases where its
> contents are wider than the border box.
>
> I think it would be better to say that the anonymous table box is as wide
> as max(table-width, table-caption-min-intrinsic-width).
>
> Testcase:
> http://lists.w3.org/Archives/Public/www-archive/2010Jun/att-0015/table-caption-004.xht
> (I think Firefox has the behavior we want.)

Ok, so I've puttered around with that testcase and the behavior in
Mozilla is kinda weird and not super-useful. The most consistent
behavior is the implementations that follow the spec exactly, and
make the outer table box exactly the width of the table box (which
triggers the aforementioned overflow). Prince, Opera, and IE8 all
follow the spec on this.

One possible useful behavior would probably be
   - assigning the outer table box min-width: min-content, so that
     neither the captions nor the table box overflow
   - duplicating any 'auto' margins assigned to the table on both
     the outer table box and the inner table box, so that alignment
     still works
However, we obviously don't have any implementations of this.

Another possibility is to have the width of the caption factor into
the width of the table, as if it were a table cell, which is what
Konqueror does (and, IIRC, a number of older browser implementations
did). This is currently allowed per spec for auto table layout, and
might be the most useful option.

Suggesting this behavior more explicitly would require changes to
the informative section on table widths, something like the following:

   # This gives a maximum and minimum width for each column.

Insert paragraph break and the following text:

   | The caption width minimum (CAPMIN) is determined by calculating
   | the minimum caption widths just as for table cells, but also
   | including for each caption its padding, border, and margin
   | widths (while assuming 'auto' widths to be zero). The greatest
   | of the minimum caption widths is CAPMIN.

   # Column widths influence the final table width as follows:
   # 1. If the 'table' ... other than 'auto', the property's value
   #    as used for layout is the greater of W and the minimum width
   #    required by all the columns plus cell spacing or borders
   #    (MIN). If W is greater than MIN, the extra width should be
   #    distributed over the columns.

s/Column widths/Column and caption widths/
s/the property's value as used for layout/used width/
s/W and/W, CAPMIN, and/
s/If W/If the used width/

   #  2. If the 'table' ... has 'width: auto', the table width used
   #     for layout is the greater of the table's containing block
   #     width and MIN.

s/the table width used for layout/used width/
s/width and MIN/width, CAPMIN, and MIN/

   #     However, if the maximum width required by the columns plus
   #     cell spacing or borders (MAX) is less than that of the
   #     containing block, use MAX.

s/if the/if either CAPMIN or the/
s/use MAX/use max(MAX, CAPMIN)/

~fantasai

Received on Friday, 20 August 2010 00:17:17 UTC