HTML center tag does not center

Hello! I know most web development folk would be horrified that I would ask a question about such shoddy deprecated code as this, but please help me out.


<html>
<body>
<table width="100%" align="right">
<tr>
<td align="right">
Right1<br />
Right2<br />
Right3<br />
Right4<br />
Right5<br />
</td>
</tr>
</table>
<center>
One<br />
Two<br />
Three<br />
Four<br />
Five<br />
</center>
</body>
</html>

Why does the content in the center tag appear on the left rather than the center like it should? And what is the simplest, least-intrusive way to fix it? I know putting in a DOCTYPE would fix it right up, but I really don’t want to go messing around with existing production code.

I’m truly horrified that you would ask a question about such shoddy deprecated code as this! :shifty:

Anyhow, some browsers will center that content—with or without the doctype (such as Firefox). What browser are you testing in?

I guess you could continue with the pattern of the code you already have, and change it to this:

<table width="100%">
<tr>
<td [COLOR="#FF0000"]align="center"[/COLOR]>
One<br />
Two<br />
Three<br />
Four<br />
Five<br />
</td>
</tr>
</table>

or this


<html>
<body>
<table width="100%">
<tr>
<td align="right">
Right1<br />
Right2<br />
Right3<br />
Right4<br />
Right5<br />
</td>
</tr>
<tr>
<td align="center">
One<br />
Two<br />
Three<br />
Four<br />
Five<br />
</td>
</tr>
</table>
</body>
</html>

The text was not centered in I.E. 9, but you were correct: the text was centered in Firefox (and Chrome)

Both of those solutions worked great. Thank you!