<th> 要素は、tableの中のヘッダーセルを表します。
- カテゴリー
- なし
- 配置場所
<tr> 要素の子要素として。- 内容
- フロー・コンテンツ。ただし、
<header> 要素、<footer> 要素、セクショニング・コンテンツ、ヘディング・コンテンツを除く。 - 属性
-
scope="対象範囲"HTML5で追加- このセルの対象となるセルの範囲をキーワードで指定します。
rowこのセルと同じ行の後続(右側)のセル。 colこのセルと同じ列の後続(下側)のセル。 rowgroupこのセルを含む行グループ thead、tbody、tfoot内のセル。このセルが行グループにない場合は指定できません。colgroupこのセルを含む列グループ colgroup内のセル。このセルが列グループにない場合は指定できません。 - グローバル属性
accesskey,autocapitalize,autofocus,class,contenteditable,data-*,dir,draggable,enterkeyhint,hidden,id,inputmode,is,itemid,itemprop,itemref,itemscope,itemtype,lang,nonce,spellcheck,style,tabindex,title,translate
サンプル
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="utf-8" />
<title>HTML5 › th</title>
<style>
table { border-collapse: collapse; }
th, td { padding: .5em; border: #ccc 1px solid; }
thead th { background: #eef; }
tbody th { background: #fee; }
</style>
</head>
<body>
<h1>HTML5 › th</h1>
<table>
<caption>ランキング表</caption>
<thead>
<tr>
<th id="name">名前</th>
<th id="jan"> 1月 </th>
<th id="feb"> 2月 </th>
<th id="mar"> 3月 </th>
</tr>
</thead>
<tbody>
<tr>
<th headers="name" id="yaruo">デキ杉ヤル夫</th>
<td headers="yaruo jan"> 1位 </td>
<td headers="yaruo feb"> 1位 </td>
<td headers="yaruo mar"> 1位 </td>
</tr>
<tr>
<th headers="name" id="dameo">丸出ダメ男</th>
<td colspan="3" headers="dameo jan feb mar">圏外。</td>
</tr>
</tbody>
</table>
</body>
</html>
