...

View Full Version : unable to center text in a table



jasonpc1
04-15-2011, 10:04 PM
i have tried to place the 'TEXT TO CENTER' in the center of the page using SPAN but does not seem to work, i have also tried to use <p> instead but still the bordered box is left aligned.

I would center the whole table but this then messes up all the text and I would have to left align all text, adding even more code.

How can I center just this section without having to recode the rest of the page ?



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>

<table style="border: 0px solid rgb(54, 95, 145); text-align: left; width: 600px; height: 172px; font-size: 7pt;" border="0" cellpadding="2" cellspacing="0">
<tbody>

<tr valign="top">
<td colspan="2" bgcolor="#eaeaea" style="width: 600px;">
<blockquote>

<!-- only edit below this line -->
<br><span style="width: 600px; border: 2px solid #41A808; font-size: 12pt; padding: 5px; margin-bottom: 5px; text-align: center; font-weight: bold; color: #002060;">TEXT TO CENTER</span><br>
<!-- no edit below this line -->

</blockquote>
</td>
</tr>

</tbody>
</table>

</body>
</html>

harbingerOTV
04-16-2011, 04:54 PM
add display: block; to your span

You are giving it a width but, a span is inline by default and the width will not be applied unless you change it to be block level.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum