caption 要素
4.9.2 caption 要素
Status: Last call for comments
- カテゴリー
- なし
- この要素を使うことができるコンテキスト:
table要素の最初の子要素として- コンテンツ・モデル:
- フロー・コンテンツ。ただし、
table要素を子孫に入れてはいけません。 - コンテンツ属性:
- グローバル属性
- DOMインタフェース:
-
interface HTMLTableCaptionElement : HTMLElement {};
caption 要素は、その親が table 要素であれば、その table 要素のタイトルを表します。
table 要素が、figure 要素の中で figcaption を除いて唯一のコンテンツであるとき、その caption 要素は、figcaption を優先して、省略されるべきです。
キャプションを使って、そのコンテンツを説明し、それをかなり理解しやすいようにすることができます。
例えば、次のテーブルを考えてみましょう:
| 1 | 2 | 3 | 4 | 5 | 6 | |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | 5 | 6 | 7 |
| 2 | 3 | 4 | 5 | 6 | 7 | 8 |
| 3 | 4 | 5 | 6 | 7 | 8 | 9 |
| 4 | 5 | 6 | 7 | 8 | 9 | 10 |
| 5 | 6 | 7 | 8 | 9 | 10 | 11 |
| 6 | 7 | 8 | 9 | 10 | 11 | 12 |
この抜粋では、この表が明確ではありません。しかし、テーブルの番号(本文での参照に使います)を与え、その用途を説明するキャプションを入れることで、より分かりやすくなります:
<caption> <p>Table 1. <p>This table shows the total score obtained from rolling two six-sided dice. The first row represents the value of the first die, the first column the value of the second die. The total is given in the cell that corresponds to the values of the two dice. </caption>
※ 原文:http://www.w3.org/TR/2010/WD-html5-20100624/tabular-data.html#the-caption-element