Log in

View Full Version : Problems with centering a Div or Table



jrthib
04-19-2007, 09:34 PM
Here is where you can view my problem: http://www.tclinc.com/newsite/

the problem occurs with the header containing the navigation bar will not center. I'm using a css style sheet to center this and i've also added center tags onto the containing table and the object itself. I'm puzzled. By the way, this problem only occurs in IE6+

thanks in advance for suggestions!

techno_race
04-20-2007, 12:51 AM
Have you tried:

<table align="center">

mburt
04-20-2007, 10:40 AM
No, that would only center the table's content:

<div style="text-align:center;">
<table>
...
</div>

deficit
04-23-2007, 12:37 AM
Or, if you REALLY want to make sure it centers across all browsers, set the DIV like this:



<div style="margin-right: auto; margin-left: auto; text-align: center;">
<table>
<tr>
<td>
content
</td>
</tr>
</table>
</div>

mburt
04-23-2007, 12:48 AM
Or, equally:

margin:0px auto;

deficit
04-23-2007, 01:02 AM
Duly noted, mburt - much more efficient (less typing) :P. tyvm.