HTML th colspan attribute
Examples
The following HTML table contains a table header cell spanning two columns:
<table border="1">
<tr>
<th colspan="2">Monthly Savings</th>
</tr>
<tr>
<td>January</td>
<td>$100</td>
</tr>
<tr>
<td>February</td>
<td>$80</td>
</tr>
</table>
<tr>
<th colspan="2">Monthly Savings</th>
</tr>
<tr>
<td>January</td>
<td>$100</td>
</tr>
<tr>
<td>February</td>
<td>$80</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
The number of columns colspan attribute definition header cell should span of.
Differences between HTML 4.01 and HTML5
no.
grammar
<th colspan="number">
Property Value
值 | 描述 |
---|---|
number | 规定表头单元格应该横跨的列数。注意: colspan="0" 告知浏览器使单元格横跨到列组 (colgroup) 的最后一列。 |
HTML <th> tag