HTML <col> Tag

Description

The <col> HTML element sets the width and other characteristics of one or more columns of a table. With this element, the browser starts showing the contents of the table, without waiting for it to fully load. <col> can be used in conjunction with the <colgroup> element, which defines a group of columns that share common characteristics.

Properties

Permitted Parents
<colgroup> only, though it can be implicitly defined as its start tag is not mandatory. The <colgroup> must not have a span attribute.
Content
None. It is an empty element.
Start/End Tags
Start tag: required, End tag: forbidden

Example

<table border="1">
<colgroup span="2" style="background-color: #DFF0D8;"></colgroup>
<col span="1" style="background-color: lightblue;">
<tr>
<th>Country</th>
<th>Capital</th>
<th>Population (in millions)</th>
<th>Language</th>
</tr>
<tr>
<td>USA</td>
<td>Washington D.C.</td>
<td>331</td>
<td>English</td>
</tr>
<tr>
<td>France</td>
<td>Paris</td>
<td>67</td>
<td>French</td>
</tr>
<tr>
<td>Germany</td>
<td>Berlin</td>
<td>83</td>
<td>German</td>
</tr>
</table>

Attributes

Attribute Definition
span Specifies how many columns to span.

Global Attributes

The <col> tag also supports the Global Attributes in HTML5

Event Attributes

The <col> tag also supports the Event Attributes in HTML5

Browser Support

The following table will show you the current browser support for the HTML <col> tag.

Desktop
Edge Chrome Firefox Opera Safari
1211154
Tablets / Mobile
Chrome Firefox Opera Safari Samsung Webview
184143.214.4

Last updated by CSSPortal on: 30th March 2024