Log in

View Full Version : trouble controling cell width



gib65
02-15-2012, 10:09 PM
I have a table that looks like this:



<table style="height: 100%;" cellspacing=0 cellpadding=0 border=1>

<tr><td colspan=2 style="height: 100px;">
<center>
<span style="font-size: 24pt; text-align: center;">
<img src="H&R banner.jpg" border=0></span></center></td></tr>

<tr>

<td style="width: 200px;">
<center>
<span style="text-align: center;">
MARGIN<br>
(latest news)<br>
(possibly links)
</span>
</center>
</td>

<td>
<table style="width: 100%; height: 100%" cellspacing=0 cellpadding=0 border=1>
<tr>
<td style="height: 50px;">
<center>
<span style="font-size: 14pt;">menu bar</span>
</center></td>
</tr>
<tr>
<td>
<center>
<span style="font-size: 24pt; text-align: center;">
CONTENT
</span>
</center>
</td>
</tr>
</table>
</td>

</tr>
</table>


I'm having trouble controling the width of the first bolded table cell. This happens in IE9. I have it set to 200px, but for some reason it wants to be wider than that (I can tell because the text seems to be centering within the first 200px of its width, but it's not centered within the whole cell). I can fix this by specifying a % width (as in style="width: 25%;"), but I'd prefer to stay away from percentages. I can also fix the problem by specifying the width of the next cell (to its right, in bold above) to some specific value, but then this fixes the size of the whole table, and I would like to keep it variable.

Does anyone know why the width likes to increase to more than I specified, and if so, how do I fix this problem?

davelf
02-16-2012, 02:40 AM
1. i recommend you to change that font-size from pt to px.
2. this <center></center> and <span style="text-align: center;"></span> you don't need this, just place align="center" in <td></td>

gib65
02-16-2012, 07:32 PM
I made the changes you recommended but unfortunately it didn't help.