Welcome to WebmasterWorld Guest from 54.146.248.111

Forum Moderators: not2easy

Message Too Old, No Replies

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

TD's Tables and CSS

     

organic21

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

<td>
<div class="center">

<table>

CONTENT

</table>

</div>
<td>

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
thanks

organic21

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

10+ Year Member



oh sorry

something is missing

the CSS

div.center { text-align: center; }

grahamstewart

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.

e.g.

td table {
margin: 0 auto;
}

should cause all tables to be centered within data cells.

Have you tried this?

organic21

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