HTML <td> colspanAttribute
Examples
The following HTML table contains a table cell that spans two columns:
<table border="1">
<tr>
<th>Month</th>
<th>Savings</th>
</tr>
<tr>
<td>January</td>
<td>$100</td>
</tr>
<tr>
<td>February</td>
<td>$100</td>
</tr>
<tr>
<td colspan="2">Sum: $180</td>
</tr>
</table>
<tr>
<th>Month</th>
<th>Savings</th>
</tr>
<tr>
<td>January</td>
<td>$100</td>
</tr>
<tr>
<td>February</td>
<td>$100</td>
</tr>
<tr>
<td colspan="2">Sum: $180</td>
</tr>
</table>
Try it Yourself »
Browser Support
![]()
![]()
![]()
![]()
![]()
All major browsers support the colspan attribute.
Note:Only Firefox supports colspan="0", which has a special meaning (see the "Attribute Values" table below).
Definition and Usage
The colspan attribute defines the number of columns a cell should span.
Differences between HTML 4.01 and HTML5
None.
Syntax
<td colspan="number">
Attribute Values
| Value | Description |
|---|---|
| number | Specifies the number of columns a cell should span.Note:colspan="0" tells the browser to span the cell to the last column of the column group (colgroup). |
HTML <td> Tag Other Extensions