HTML td colspan attribute
Examples
The following table contains an HTML spans two table cell:
<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"
Browser Support
All major browsers support colspan attribute.
Note: Only Firefox supports colspan = "0", this value has a special meaning (see below "property values" table).
Definition and Usage
Colspan attribute defines the number of columns the cell should span of.
Differences between HTML 4.01 and HTML5
no.
grammar
<td colspan="number">
Property Value
值 | 描述 |
---|---|
number | 规定单元格应该横跨的列数。注意: colspan="0" 告知浏览器使单元格横跨到列组 (colgroup) 的最后一列。 |
HTML <td> tag