Last Updated : 11 Jul, 2025
HTML <col> tag defines attributes for table columns within the <colgroup> element, allowing styling and formatting of columns, such as width, alignment, and background color. This tag does not contain closing tags.
<col>
can be applied to multiple columns at once, simplifying the table's look.
<!DOCTYPE html>
<html>
<body>
<table>
<colgroup>
<col span="1"
style="background-color: green" />
<col span="1"
style="background-color: red" />
<col span="1"
style="background-color: none" />
</colgroup>
<tr>
<th>NAME</th>
<th>AGE</th>
<th>BRANCH</th>
</tr>
<tr>
<td>BITTU</td>
<td>22</td>
<td>CSE</td>
</tr>
<tr>
<td>RAM</td>
<td>21</td>
<td>ECE</td>
</tr>
</table>
</body>
</html>
Syntax
<col style="property:value;">Attributes
The various attributes that can be used with the col tag are listed below. Most of the attributes are not supported by HTML5.
Attributes
Descriptions
It is used to define the number of columns on which property will be applied.
This attribute is used to define the CSS to change the properties of the column (deprecated).
This attribute is used to set the alignment of the content of <col> element (deprecated).
It is used to specify the width of a <col> element (deprecated).
It is used to specify the number of characters the content will be aligned from the character specified by the char attribute (deprecated).
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4