HTML <col>Tag
Examples
The <colgroup> and <col> tags set the background color for three columns in the table:
<table border="1">
<colgroup>
<col span="2" style="background-color:red">
<col style="background-color:yellow">
</colgroup>
<tr>
<th>ISBN</th>
<th>Title</th>
<th>Price</th>
</tr>
<tr>
<td>3476896</td>
<td>My first HTML</td>
<td>$53</td>
</tr>
</table>
<colgroup>
<col span="2" style="background-color:red">
<col style="background-color:yellow">
</colgroup>
<tr>
<th>ISBN</th>
<th>Title</th>
<th>Price</th>
</tr>
<tr>
<td>3476896</td>
<td>My first HTML</td>
<td>$53</td>
</tr>
</table>
Try it yourself »
Browser Support
![]()
All major browsers support the <col> tag.
Tag Definition and Usage Instructions
The <col> tag specifies<colgroup>column properties for each column within the element.
By using the <col> tag, you can apply styles to an entire column without having to repeatedly set styles for each cell or each row.
Differences between HTML 4.01 and HTML5
Most attributes in HTML 4.01 are no longer supported in HTML5.
Differences between HTML and XHTML
In HTML, the <col> tag has no end tag.
In XHTML, the <col> tag must be properly closed.
Attributes
| Attribute | Value | Description |
|---|---|---|
| align | left right center justify char |
Not supported in HTML5.Specifies the horizontal alignment of content related to the <col> element. |
| char | character | Not supported in HTML5.Specifies which character to align the content related to the <col> element against. |
| charoff | number | Not supported in HTML5.Specifies the offset of the first alignment character. |
| span | number | Specifies the number of columns the <col> element should span. |
| valign | top middle bottom baseline |
Not supported in HTML5.Specifies the vertical alignment of content related to the <col> element. |
| width | % pixels relative_length |
Not supported in HTML5.Specifies the width of a <col> element |
Global Attributes
The <col> tag supportsHTML Global Attributes。
Event Attributes
The <col> tag supportsHTML Event Attributes。
Other Extensions