W3C home > Mailing lists > Public > www-validator@w3.org > April 2002

Re: Centring Tables in HTML 4.01 Strict...?

From: Charles Walker <cewalker@kingston.net>
Date: Sun, 21 Apr 2002 17:33:18 -0400
To: kynn@idyllmtn.com
Cc: www-validator@w3.org
Message-Id: <MKW96W6FCFDGFLEASODAJDGBLFA0.3cc3301e@charlie>
Perfect.  Works like a charm!  I also retained the original body declaration, 
without which the non-compliant browsers won't center-align the table. 
Is this okay as a work-around?

body { text-align:center; } 
table { margin-left: auto; margin-right: auto; }

Thanks so much!
Charlie

-----------------------------------

21/04/2002 4:57:44 PM, kynn@idyllmtn.com wrote:

>You wrote:
>> I've got a question that has been bothering me for a while now.  The HTML 4.01 Strict specifications have declared the "align" attribute of the 
>> <table> tag as deprecated.  HOW are we supposed to centre a table in the browser window? I've tried everything I can think of, with no real 
>> solution.  For instance, the following CSS declaration produces only partial results; the browsers that I would expect to support it, don't:
>> body { text-align:center }
>
>That's not how you center block content in CSS. Instead, try this:
>
>table { margin-left: auto; margin-right: auto; }
>
>--Kynn
Received on Sunday, 21 April 2002 17:33:45 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 25 April 2012 12:14:03 GMT