HTML Dog
Skip to navigation

HTML Tag: colgroup

Column group in a table.

colgroup elements are children of table elements and should only ever appear after a caption element, if such an element is used.

Often used in conjunction with col.

Optional Attributes

Attribute Description Possible values
span The number of columns the colgroup 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>