W3C home > Mailing lists > Public > www-talk@w3.org > May to June 2001

RE: CSS to center a table?

From: Fish <fish@infidels.org>
Date: Sat, 19 May 2001 04:58:22 -0700
To: <www-talk@w3.org>
Message-ID: <000101c0e05b$00c30340$0200a8c0@proteva>
> -----Original Message-----
> From: www-talk-request@w3.org [mailto:www-talk-request@w3.org]On Behalf
> Of Michael D. Crawford
> Sent: Friday, May 18, 2001 11:12 PM
> To: www-talk@w3.org
> Subject: CSS to center a table?
> Is there a way to use cascading stylesheets to center a table
> horizontally on a page?

I don't know.

What I DO know is I sure as hell don't know how to do it. :)

> I can give offsets in absolute values or percentages from the left or
> right, but my tables have different widths.  I'd like each table in my
> page to be centered no matter how wide or narrow it may be, using the
> same class for such tables.

Why use a class? I mean, if you're going to go to the bother of specifying
"class=whatever" in every <TABLE> tag, why don't you instead just specify
"align=center" and be done with it?

<title>Fish Center Table Example</title>
<h1>Fish Center Table Example</h1>
<p>This text should <i><u>not</u></i> be centered,
but the following table <i><u>should</u></i> be...
<table border=1 align=center>
  <tr><td>Some text...</td></tr>
  <tr><td>Some text that is longer than the above text...</td></tr>

"Fish" (David B. Trout)
Received on Saturday, 19 May 2001 07:58:34 UTC

This archive was generated by hypermail 2.4.0 : Monday, 20 January 2020 16:08:25 UTC