HTML <td> scope属性
例
次の例では、2つの <th> 要素を列のヘッダーとして、2つの <th> 要素を行のヘッダーとして識別します:
<table border="1">
<tr>
<th></th>
<th scope="col">Month</th>
<th scope="col">Savings</th>
</tr>
<tr>
<td scope="row">1</td>
<td>January</td>
<td>$100</td>
</tr>
<tr>
<td scope="row">2</td>
<td>February</td>
<td>$80</td>
</tr>
</table>
<tr>
<th></th>
<th scope="col">Month</th>
<th scope="col">Savings</th>
</tr>
<tr>
<td scope="row">1</td>
<td>January</td>
<td>$100</td>
</tr>
<tr>
<td scope="row">2</td>
<td>February</td>
<td>$80</td>
</tr>
</table>
試してみる »
ブラウザサポート
![]()
![]()
![]()
![]()
![]()
scope 属性は、通常の Web ブラウザでは視覚的効果はありませんが、スクリーンリーダーで使用できます。
定義と使い方
HTML5 は <td> scope 属性をサポートしていません。
scope 属性は、テーブル内のヘッダーセルとデータセルを関連付ける方法を定義します。
scope 属性は、セルが列、行、列グループ、または行グループのヘッダーであるかどうかを識別します。
構文
<td scope="col|row|colgroup|rowgroup">
属性値
| 值 | 説明 |
|---|---|
| col | セルが列のヘッダーであることを指定します。 |
| row | セルが行のヘッダーであることを指定します。 |
| colgroup | セルが列グループのヘッダーであることを指定します。 |
| rowgroup | セルが行グループのヘッダーであることを指定します。 |
HTML <td> タグ その他の拡張