HTML » Tags » col

Version: 4.0

Compability: Explorer 4, 5  Netscape 6

Syntax:
<col>

The <col> tag is used to assign attribute values to the individual columns within the colgroup elements.

The col tag can only be used inside a colgroup element. However, this tag must be omitted if you are using the span attribute of the colgroup tag.
 
There is no closing tag.
 

Examples

Code:
<table width="90%" border="10" cellspacing="5">
<caption>
<center><b>Column Group Table</b></center>
<br>
This table uses the <b>colgroup</b> and <b>col</b> tags
</caption>
<colgroup>
<col width="20%">
<col width="30%">
<col width="15%">
</colgroup>
<colgroup>
<col width="15%">
<col width="20%">
</colgroup>
<tr>
<th>First Column Header</th>
<th>Second Column Header</th>
<th>Third Column Header</th>
<th>Fourth Column Header</th>
<th>Fifth Column Header</th>
</tr>
<tr>
<td>First Column First Row</td>
<td>Second Column First Row</td>
<td>Third Column First Row< /td>
<td>Fourth Column First Row</td>
<td>Fifth Column First Row</td>
</tr>
<tr>
<td>First Column Second Row</td>
<td>Second Column Second Row </td>
<td>Third Column Second Row</td>
<td> Fourth Column Second Row</td>
<td>Fifth Column Second Row</td>
</tr>
</table>
Output:
Column Group Table

This table uses the colgroup and col tags
First Column HeaderSecond Column HeaderThird Column HeaderFourth Column HeaderFifth Column Header
First Column First RowSecond Column First RowThird Column First RowFourth Column First RowFifth Column First Row
First Column Second RowSecond Column Second RowThird Column Second RowFourth Column Second RowFifth Column Second Row
Language(s): HTML

See Also: