You are here: Reference > HTML > attributes > colSpan (td, th)

colSpan attribute (td, th)

Browser support:
Sets how many columns wide a cell should be.
If you want to change how many rows high the cell should be, use the rowSpan attribute.
JavaScript page for this attribute: colSpan. You can find other example(s) there.

Possible values:

Integer that sets the number of columns to span.
Default: this attribute has no default value.

Example HTML code 1:

This example illustrates the use of the colSpan attribute:
<table border="3px" id="myTable">
    <tr>
        <td colspan="2">Apple</td>
    </tr>
    <tr>
        <td>Pear</td>
        <td>35.21</td>
    </tr>
    <tr>
        <td>Peach</td>
        <td>23.12</td>
    </tr>
</table>
Did you find this example helpful? yes no

Supported by tags:

Related pages:

External links:

User Contributed Comments

Post Content

Post Content