rowspan 属性は、結合するセルの行数を指定します。
rowspan 属性は、以下の要素で使用することができます:
| 要素 | 属性 |
|---|---|
| <td> | rowspan |
| <th> | rowspan |
2 つの行を結合したテーブルセルを持つ HTML テーブル:
<table>
<tr>
<th>Month</th>
<th>Savings</th>
<th>Savings for holiday!</th>
</tr>
<tr>
<td>January</td>
<td>$100</td>
<td rowspan="2">$50</td>
</tr>
<tr>
<td>February</td>
<td>$80</td>
</tr>
</table>
Try it Yourself ❯
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>
Try it Yourself ❯
rowspan 属性は、要素ごとに以下のブラウザがサポートしています。
| 要素 | |||||
|---|---|---|---|---|---|
| td | Yes | Yes | Yes | Yes | Yes |
| th | Yes | Yes | Yes | Yes | Yes |