Html-th-tag
提供:Dev Guides
HTML-<th>タグ
説明
HTML <th>タグは、テーブル内のヘッダーセルまたはテーブルヘッダーを指定するために使用されます。
例
<!DOCTYPE html>
<html>
<head>
<title>HTML th Tag</title>
</head>
<body>
<table border = "1">
<tr>
<th>ID</th>
<th>Product Details</th>
</tr>
<tr>
<td>00L1</td>
<td>i3, 500gb laptop</td>
</tr>
</table>
</body>
</html>
これは、次の結果を生成します-
グローバル属性
このタグは、− link:/html/html_attributes_reference [HTML属性リファレンス]で説明されているすべてのグローバル属性をサポートします
特定の属性
HTML <th>タグは、次の追加属性もサポートしています-
| Attribute | Value | Description |
|---|---|---|
| abbr | abbreviated_text | Deprecated − Specifies an abbreviated version of the content in a header cell. |
| align | right left center justify char | Deprecated − Content alignment in header cell. |
| axis | name | Deprecated − Specifies a category for this th. |
| bgcolor | rgb(x,x,x) #hexcode colorname | Deprecated − Specifies the background color of the header cell. |
| char | character | Deprecated − Specifies which character to align text on. Used when align = "char" |
| charoff | pixels or % | Deprecated − Specifies an alignment offset (either in pixels or percentage value) against the first character as specified with the char attribute. Used when align = "char" |
| colspan | number | Specifies the number of columns the header cell spans across. |
| headers | id | Specifies one or more header cells a cell is related to. |
| height | pixels | Deprecated − Specifies the height of the header cell. |
| nowrap | nowrap | Deprecated − Prevents text from automatically wrapping. |
| rowspan | numbers | Specifies the number of rows the header cell spans across. |
| scope | col colgroup row rowgroup | This attribute is used on header cells and specifies the cells that will use this header’s information. |
| valign | top middle bottom baseline | Deprecated − Vertical alignment. |
| width | pixels or % | Deprecated − Specifies the width of the header cell |
イベント属性
このタグは、− link:/html/html_events_reference [HTMLイベントリファレンス]で説明されているすべてのイベント属性をサポートします。
ブラウザのサポート
| Chrome | Firefox | IE | Opera | Safari | Android |
|---|---|---|---|---|---|
| Yes | Yes | Yes | Yes | Yes | Yes |