Align TABLE to center of the BODY

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

Align TABLE to center of the BODY

Post by anjanesh »

I understand that in XHTML strict for <table>, align is not available.
I had this previously :

Code: Select all

<body>
<table align="center">
...
</table>
</body>
What I want is y table to be aligned in center of the page(body) NOT the content of the table aligned to center which is what happened when I did <table style="text-align:center">
I searched google and found that the replacement for align=center is now CSS's text-align:center but the output is really not the same.
Is there anyway for my table to be aligned center of the page(body)?
Thanks
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

tried placing a div around the table that has the alignment setting? It's been a while since I screwed around with this stuff...
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

Can't you just do

Code: Select all

<center>
<table>
....
</table>
</center>
??
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

Code: Select all

.center &#123;
   text-align: center;
&#125;

.left &#123;
   text-align: left;
&#125;

Code: Select all

<div class="center">
<table class="left">
</table>
</div>
Post Reply