HTML5 <col> Tag

Example

<table>
<col span="2" style="background-color:red" />
  <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 »

Definition and Usage

The <col> tag defines attribute values for one or more columns in a table.

The <col> tag is useful for applying styles to entire columns, instead of repeating the styles for each cell, for each row.

The <col> tag can only be used inside a table or a colgroup element.


Differences Between HTML 4.01 and HTML5

Most of the attributes from 4.01 are not supported in HTML5.


Tips and Notes

Note: The col element is an empty element. To create columns, you must specify td elements within a tr element.

Tip: Use the <col> when you want to specify different attribute values to more than one table column.

Tip: Use the <colgroup> element if you want to specify the same attribute values to a group of columns.


Attributes

Attribute Value Description
align left
right
center
justify
char
Not supported in HTML5
char character Not supported in HTML5
charoff number Not supported in HTML5
span number Specifies the number of columns a col element should span
valign top
middle
bottom
baseline
Not supported in HTML5
width %
pixels
relative_length
Not supported in HTML5

Standard Attributes

The <col> tag also supports the Standard Attributes in HTML5.


Event Attributes

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