W3C home > Mailing lists > Public > www-style@w3.org > December 2002

Re: Should centering a table center the caption?

From: fantasai <fantasai@escape.com>
Date: Tue, 17 Dec 2002 15:35:56 -0500
Message-ID: <3DFF8AAC.2040204@escape.com>
To: www-style@w3.org

Marc-Etienne Vargenau wrote:
> Hello,
> 
> I need some expert advice on centering a table with CSS.
> 
> I know that I have to use
> margin-left:auto; margin-right: auto;
> to center the table with CSS.
> 
> With Opera, this centers the whole table, i.e. the cells and the caption.
> With Mozilla, this centers only the cells, not the caption.
> 
> Who is right?

Mozilla is right.

   | 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.

   --- http://www.w3.org/TR/REC-CSS2/tables.html#q5

There's even a picture, if you're unsure.
Received on Tuesday, 17 December 2002 15:35:19 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:54:18 GMT