HTML <td> colspan属性
例
2つの列にまたがるテーブルセルを持つHTMLテーブル:
<table>
<tr>
<th>Month</th>
<th>Savings</th>
</tr>
<tr>
<td>January</td>
<td>$100</td>
</tr>
<tr>
<td>February</td>
<td>$80</td>
</tr>
<tr>
<td colspan="2">Sum: $180</td>
</tr>
</table>
定義と使用法
このcolspan
属性は、セルがまたがる列の数を定義します。
ブラウザのサポート
Attribute | |||||
---|---|---|---|---|---|
colspan | Yes | Yes | Yes | Yes | Yes |
注: Firefoxのみがサポートしますcolspan="0"
。これには特別な意味があります(以下の「属性値」の表を参照してください)。
構文
<td colspan="number">
属性値
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>タグ