Try using class names in your markup and using colgroup . This is by far the least problem since you only define width in colgroup and are compatible with multiple browsers.
Eg.
<table> <colgroup> <col class="colOne" /> <col class="colTwo" /> </colgroup> <tr> <td>data in first column</td> <td>data in second column</td> </tr> <tr> <td>more data in first column</td> <td>more data in second column</td> </tr> </table> /* CSS */ .colOne{ width: 50px; } .colTwo{ width: 180px; }
See the script: http://jsfiddle.net/4ebnE/
One thing, however, colgroup deprecated in HTML5. But then again, HTML5 is not yet standardized, so you can make the call.
Oh, and it's possible to do without CSS if you want:
<table> <colgroup> <col width="50"/> <col width="180" /> </colgroup> <tr> <td>data in first column</td> <td>data in second column</td> </tr> <tr> <td>more data in first column</td> <td>more data in second column</td> </tr> </table>
source share