You are here: Reference > HTML > attributes > span (col, colgroup)

span attribute (col, colgroup)

Browser support:
Specifies the number of columns in a column group that share the settings defined in the col element.
The col and colGroup elements are useful if you want to use the same settings (align, class, style...) for all table cells in the current column.
JavaScript page for this attribute: span. You can find other example(s) there.

Possible values:

Integer that sets the numer of columns. Default: 1.
Default: 1.

Example HTML code 1:

This example illustrates the use of the span attribute:
<table border="1px">
    <col style="background-color: #a0f0a0;" />
    <col span="2" style="background-color: #a0a0f0;" />
    <tbody>
        <tr>
            <td>Apple</td>
            <td>$5</td>
            <td>$10.7</td>
        </tr>
        <tr>
            <td>Pear</td>
            <td>$10.50</td>
            <td>$8.20</td>
        </tr>
        <tr>
            <td>Peach</td>
            <td>$23.30</td>
            <td>$19.45</td>
        </tr>
    </tbody>
</table>
Did you find this example helpful? yes no

Supported by tags:

External links:

User Contributed Comments

Post Content

Post Content