Forum Moderators: not2easy
<table style="width: 100%;">
<tr>
<td style="width: 1/3 of the page">
</td>
<td style="width: 1/3 of the page">
</td>
<td style="width: 1/3 of the page">
</td>
</tr>
</table>
But as we all know, 1/3 is a repeating decimal that never ends. Is there a way to specifiy a table cell width as 1/3 of the page?
Browser will round the result of any calculation to a pixel. Moreover some browsers are notoriously bad at math.
Hence there really is no need for infinite precision math, 33.3% will do fine for most uses as the error is far less than a pixel on any realistic browser width (the error is less than half a pixel up to 1500px wide).
Ah, and with css you can stop abusing tables for layout purposes.
But 100% is going to give some reeeealy wide and hard to read lines. Try implementing max-width.
If the math kills you, just make the center one 34%, or the outer's 34 and the inner 32. Optically the outer ones will look fine because of the margins.
Keep in mind, however, your widths will get pushed around if the content is unequal. Browsers follow the same mantra, "content is king" and will override markup in some cases.
<style type="text/css">
#my-table { width:100%; margin:auto; max-width:1024px; } /* or ems... */
#my-table td { width: 33%; }
#my-table #ctr { width: 34%; }
</style>
<table id="my-table">
<tr>
<td width="33%"> </td>
<td id="#ctr" width="34%"> </td>
<td width="33%"> </td>
</tr>
</table>
If you're going to use a table, might as well apply the width attributes, will spare a lot of headaches.