Centring a table on a page with CSS

by "Raj Bhaskar" <raj(at)lordofthemoon.com>

 Date:  Tue, 12 Mar 2002 12:45:37 -0000
 To:  hwg-basics(at)hwg.org
  todo: View Thread, Original
Hi folks,
I've got a table on a page that I'm trying to centre as follows:

<.div align="center" id="main">
<.table>
... usual table stuff here ...
<./table>
<./div>

but it won't do it, the table remains centred to the left.  I'm guessing 
that something in my stylesheet is causing problems so I've enclosed 
the appropriate class here:

#main {background-color: #ffffff; 
border: 10px solid white; 
width: 650px; 
align: center;}

Also, I don't want to put in an explicit width here, but if I don't then the 
table will stretch to the full width of the page.  Is there any way around 
this (to have the table/div be only the width of the largest element).

TIA,
Raj.
-- 
Rajnish Bhaskar
r.bhaskar(at)compserv.gla.ac.uk, http://lordofthemoon.com
IT Education Unit, University of Glasgow
http://www.iteu.gla.ac.uk/
--
Only buffoons refer to the Internet as the Information Superhighway.
     -- (The Rough Guide to the Internet 1999)

HTML: hwg-basics mailing list archives, maintained by Webmasters @ IWA

This page is part of a preserved archive of archives.hwg.org. The site is no longer active and its content is not maintained. For enquiries about this archive, write to archive(at)iwanet.org.