HTML <td> colspan attribute
Definition and usage
colspan
Attribute defines the number of columns the cell should span.
Example
HTML table containing a cell spanning two columns:
<table> <tr> <th>Month</th> <th>Savings</th> </tr> <tr> <td>January</td> <td>¥3000</td> </tr> <tr> <td>February</td> <td>¥4000</td> </tr> <tr> <td colspan="2">Total: ¥7000</td> </tr> </table>
Syntax
<td colspan="number">
Attribute Values
Value | Description |
---|---|
number |
Specifies the number of columns the cell should span. Note:colspan="0" tells the browser to span the cell to the last column of the column group (colgroup). |
Browser support
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Supported | Supported | Supported | Supported | Supported |
Note:Only Firefox supports colspan="0", which has a special meaning (see the 'Attribute Values' table above).