Re: table caption margin

Dave J Woolley wrote:
> 
> > From: fantasai [SMTP:fantasai@escape.com]
> >
> > The HTML spec says only that 'align' positions the table left,
> > right, or center; the caption is not mentioned.
> >
> >
> [DJW:]  I think this is the key point; the question
> assumes that the behaviour in hinted HTML is as well
> defined as it is in CSS, but I think it is generally
> the case that the behavour of hinted HTML is not well
> defined and that is one of the reasons why CSS should
> be used.  (Are there any big 2 versions that understand
> caption but not CSS?)
> 
> I don't believe it is possible to answer the question,
> except in the context of individual browser, in which
> case this is probably the wrong place.


Quoting from HTML4.01, B.5.2 Recommended Layout Algorithms:

  "For the purposes of layout, user agents should consider that table
captions (specified by the CAPTION element) behave like cells. Each
caption is a cell that spans all of the table's columns if at the top or
bottom of the table, and rows if at the left or right side of the
table."


This would seems to indicate that caption and table should behave as one
with regard to the table's align attribute.


CSS2, 17.4 Tables in the visual formatting model, is also clear that:

  "In both cases, the table element generates an anonymous box that
contains the table box itself and the caption's box (if present). The
table and caption boxes retain their own content, padding, margin, and
border areas, and the dimensions of the rectangular anonymous box are
the smallest required to contain both. Vertical margins collapse where
the table box and caption box touch. Any repositioning of the table must
move the entire anonymous box, not just the table box, so that the
caption follows the table."

and

  "A caption that is above or below a table box also behaves like a
block box for width calculations; the width is computed with respect to
the width of the table box's containing block."


So I'd guess that to reproduce the HTML attribute, one would need to
give the caption at least the same width and margin styles as the table.


-- 
Regards,
Val Sharp - Edinburgh

Received on Wednesday, 13 June 2001 21:13:34 UTC