HTML <th>行スパン属性
例
3行にまたがるヘッダーセルを持つHTMLテーブル:
<table>
<tr>
<th>Month</th>
<th>Savings</th>
<th rowspan="3">Savings for holiday!</th>
</tr>
<tr>
<td>January</td>
<td>$100</td>
</tr>
<tr>
<td>February</td>
<td>$80</td>
</tr>
</table>
以下の「自分で試してみてください」の例をもっと見てください。
定義と使用法
このrowspan
属性は、ヘッダーセルがまたがる行数を定義します。
ブラウザのサポート
Attribute | |||||
---|---|---|---|---|---|
rowspan | Yes | Yes | Yes | Yes | Yes |
構文
<th rowspan="number">
属性値
Value | Description |
---|---|
number | Sets the number of rows a header cell should span. Note: rowspan="0" tells the browser to span the cell to the last row of the table section (thead, tbody, or tfoot) |
その他の例
例
rowspan = "0"を使用する(Chrome、Firefox、Operaで動作します):
<table>
<thead>
<tr>
<th>Month</th>
<th>Savings</th>
<th rowspan="3">Savings for holiday!</th>
</tr>
</thead>
<tbody>
<tr>
<td>January</td>
<td>$100</td>
<td rowspan="0">$100</td>
</tr>
<tr>
<td>February</td>
<td>$80</td>
</tr>
</tbody>
</table>
❮HTML<th>タグ