View video tutorial

HTML <col> Tag

HTML

The <col> tag specifies the column properties.

HTML <col> Tag


The <col> tag specifies the column properties for each column in a element.

The <col> tag allows styling each column using CSS.

Element Attributes

Attribute Value Description
span number This attribute contains a positive integer which indicates the number of consecutive columns in the col element span. Default value is 1.

Global attributes

Global attributes may be applied on all elements, although some elements may have no effect on them.

<accesskey>, <class>, <contenteditable>, <contextmenu>, <data-*>, <dir>, <draggable>, <dropzone>, <hidden>, <id>, <lang>, <spellcheck>, <style>, <tabindex>, <title>, <translate>.

Learning with HTML Editor "Try it Now"

You can edit the HTML code and view the result using online editor.

Example

<table>
    <colgroup>
        <col span="2" style="background-color:rgb(73, 108, 131)">
        <col style="background-color:#f24576">
    </colgroup>
    <tr>
        <th>Last Name</th>
        <th>First Name</th>
        <th>Salary</th>
    </tr>
    <tr>
        <td>Greenberg</td>
        <td>Nancy</td>
        <td>$8000</td>
    </tr>
</table>
Try it Now »

Click on the "Try it Now" button to see how it works.