headers 属性は、テーブル・セルが関連する 1 つ以上のヘッダ・セルを指定します。
headers 属性は、以下の要素で使用することができます:
要素 | 属性 |
---|---|
<td> | headers |
<th> | headers |
各 <td> 要素が関連する <th> 要素を指定します:
<table>
<tr>
<th id="name">Name</th>
<th id="email">Email</th>
<th id="phone">Phone</th>
<th id="addr">Address</th>
</tr>
<tr>
<td headers="name">John Doe</td>
<td headers="email">someone@example.com</td>
<td headers="phone">+45342323</td>
<td headers="addr">Rosevn 56,4300 Sandnes,Norway</td>
</tr>
</table>
Try it Yourself ❯
各 header; セルが関連する <th> 要素を指定します:
<table>
<tr>
<th id="name" colspan="2">Name</th>
</tr>
<tr>
<th headers="name">Firsname</th>
<th headers="name">Lastname</th>
</tr>
</table>
Try it Yourself ❯
headers
属性は、要素ごとに以下のブラウザがサポートしています。
要素 | |||||
---|---|---|---|---|---|
td | Yes | Yes | Yes | Yes | Yes |
th | Yes | Yes | Yes | Yes | Yes |