Re: CSS to center a table?

On Saturday, May 19, 2001, at 08:39 , Michael D. Crawford (by way of Al 
Gilman <>) wrote:

> Is there a way to use cascading stylesheets to center a table
> horizontally on a page?

yes. this isn't the forum for "how-to" questions (try 
comp.infostystems.www.authoring.stylesheets), but
<> has your answer. 
Set the left and right margins to "auto".

> What happens when I try using text-align on the table is that the text
> in the tables cells is centered within the cells.

this is correct: text-align describes how text is aligned *within* the 
element, not how the element itself is positioned.

> Here's my first attempt:
> In article.css:
> <!-- My CSS
> {text-align: center}
> -->

replace with {margin: auto}

I'm fuzzy right now on the details of how consistently this is supported 
in the dozens of UAs released since 1996; I know only that many get it 

Received on Sunday, 20 May 2001 21:03:18 UTC