HTML <th>スコープ属性
例
2つのヘッダーセルが列のヘッダーであることを指定します。
<table>
<tr>
<th></th>
<th scope="col">Month</th>
<th scope="col">Savings</th>
</tr>
<tr>
<td>1</td>
<td>January</td>
<td>$100</td>
</tr>
<tr>
<td>2</td>
<td>February</td>
<td>$80</td>
</tr>
</table>
定義と使用法
このscope
属性は、ヘッダーセルが列、行、または列または行のグループのヘッダーであるかどうかを指定します。
注:このscope
属性は、通常のWebブラウザーでは視覚効果はありませんが、スクリーンリーダーで使用できます。
ブラウザのサポート
Attribute | |||||
---|---|---|---|---|---|
scope | Yes | Yes | Yes | Yes | Yes |
構文
<th scope="col|row|colgroup|rowgroup">
属性値
Value | Description |
---|---|
col | Specifies that the cell is a header for a column |
row | Specifies that the cell is a header for a row |
colgroup | Specifies that the cell is a header for a group of columns |
rowgroup | Specifies that the cell is a header for a group of rows |
❮HTML<th>タグ