HTML Dog
跳至导航

HTML 标签:colgroup

表格中的列组

colgroup 元素是 table 元素的子元素,并且如果使用了 caption 元素,则它应该只出现在 caption 元素之后。

通常与 col 标签结合使用。

可选属性

属性 描述 可能的值
span colgroup 元素适用的列数。 数字。
全局属性

示例


<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>