How did I not know about the col tag???
March 15th, 2009
So whilst developing away the other day I came across the <col> tag! ( Hopefully I am not alone in never having used this before.)
After a quick google I soon established that the col tag could be used to control the widths and alignments of columns in a table removing the need to constantly define td widths and alignments individually.
Simply insert a col tag above your table for every column in the table. eg.
<col width=”300″ />
<col width=”100″ />
<col width=”300″ />
<table>
<thead>
<tr>
<th>Column 1</th>
<th>Column 2</th>
<th>Column 3</th>
</tr>
</thead>
<tbody>
<tr>
<th>Column width 300px</th>
<th>Column width 100px</th>
<th>Column width 300px</th>
</tr>
</tbody>
</table>
As simple as that! Find out more about the <col> tag at http://www.w3schools.com/TAGS/tag_col.asp





