Welcome to WebmasterWorld Guest from 54.211.120.181

Forum Moderators: not2easy

Message Too Old, No Replies

Centering a table within a DIV

     
6:10 pm on Feb 3, 2007 (gmt 0)

Junior Member

10+ Year Member

joined:July 28, 2006
posts:168
votes: 0


I have a div that spans the width of a page and a small table within it, for some reason I am haivng trouble centering the table within this space.

What is the proper method to accomplish this? Intenet Explorer seems to react differently than other browsers..

Thank You,

6:18 pm on Feb 3, 2007 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Feb 21, 2005
posts: 1526
votes: 0


Here's how I do it:

<div style="width:100%;text-align:center">
<table cellpadding="0" cellspacing="0" style="margin-left:auto;margin-right:auto;text-align:left">
<tr>
<td>A Table Cell</td>
</tr>
</table>
</div>