HTML Dog

Skip to navigation

HTML Tag: col

One or more columns in a table.

col elements are children of colgroup elements.

col has no content and therefore does not warrant a closing tag.

Optional Attributes

Attribute Description Possible values
span The number of columns the col element applies to. Number.
Global attributes

Example


<table>
    <caption>Citrus</caption>
    <colgroup span="2" class="columns1and2"></colgroup>
    <tr>
        <th>Lime</th>
        <th>Lemon</th>
        <th>Orange</th>
        <th>Kumquat</th>
    </tr>
    <!-- etc. -->
</table>

<table>
    <caption>Melon</caption
    <colgroup>
        <col class="column1">
        <col span="3" class="columns2and3and4">
    </colgroup>
    <tr>
        <th>Watermelon</th>
        <th>Honeydew</th>
        <th>Winter melon</th>
        <th>Bitter melon</th>
    </tr>
    <!-- etc. -->
</table>