Welcome to WebmasterWorld Guest from

Forum Moderators: not2easy

Message Too Old, No Replies

How2 Center Table within a Datacell using CSS (NS/Opera)

TD's Tables and CSS



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

10+ Year Member

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)

10+ Year Member

oh sorry

something is missing

the CSS

div.center { text-align: center; }


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

WebmasterWorld Senior Member 10+ Year Member

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)

10+ Year Member

Ok that works. Thanks A LOT!

Featured Threads

Hot Threads This Week

Hot Threads This Month