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?

-----------------------------
<html>
<head>
<title>Fish Center Table Example</title>
</head>
<body>
<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...
<p>
<table border=1 align=center>
  <tr><td>Some text...</td></tr>
  <tr><td>Some text that is longer than the above text...</td></tr>
  <tr><td>etc...</td></tr>
</table>
</body>
</html>
-----------------------------

--
"Fish" (David B. Trout)
   fish@infidels.org
Received on Saturday, 19 May 2001 07:58:34 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 27 October 2010 18:14:26 GMT