homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / CSS
Forum Library, Charter, Moderators: not2easy

CSS Forum

How2 Center Table within a Datacell using CSS (NS/Opera)
TD's Tables and CSS

 1:04 pm on May 8, 2003 (gmt 0)

Hi everone

I am having problems centering a table that sits within a TD (Datacell)
I have found a solution for IE6, which doesnt work in Opera and NS

<div class="center">





if i align the table using HTML, which i dont want to (cause it will not validate) it comes up right in NS,IE,Opera
Once i try to text align anything in order to center the table it wont work in NS/Opera

Somone help me with that one
i Am lost



 1:06 pm on May 8, 2003 (gmt 0)

oh sorry

something is missing

the CSS

div.center { text-align: center; }


 1:12 pm on May 8, 2003 (gmt 0)

The normal way to center things in CSS is to set the left and right margin to auto.


td table {
margin: 0 auto;

should cause all tables to be centered within data cells.

Have you tried this?


 1:52 pm on May 8, 2003 (gmt 0)

Ok that works. Thanks A LOT!

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / CSS
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved