Syntax | <CAPTION>...</CAPTION> |
---|---|
Attribute Specifications |
|
Contents | Inline elements |
Contained in | TABLE |
The CAPTION element defines a table caption. When used, CAPTION must be the first element in the TABLE. Only inline elements (e.g., STRONG) may be used within CAPTION.
A good caption should provide a short heading for the table. For simple tables, the caption can also act as an adequate summary, but for more complex tables, authors should supplement the CAPTION with a full summary, either through TABLE's SUMMARY attribute or within a paragraph outside of the TABLE. The following example features a simple table where the CAPTION provides a heading and an adequate table summary:
<TABLE>
<CAPTION>Common Usenet Abbreviations</CAPTION>
<THEAD>
<TR>
<TH>Abbreviation</TH>
<TH>Long Form</TH>
</TR>
</THEAD>
<TBODY>
<TR>
<TD>AFAIK</TD>
<TD>As Far As I Know</TD>
</TR>
<TR>
<TD>IMHO</TD>
<TD>In My Humble Opinion</TD>
</TR>
<TR>
<TD>OTOH</TD>
<TD>On The Other Hand</TD>
</TR>
</TBODY>
</TABLE>
The next example uses TABLE's SUMMARY attribute to complement the CAPTION:
<TABLE SUMMARY="This table gives the character entity reference,
decimal character reference, and hexadecimal character
reference for symbols and Greek letters.">
<CAPTION>Symbols and Greek Letters in HTML 4.0</CAPTION>
<COLGROUP>
<COLGROUP SPAN=3>
<THEAD>
<TR>
<TH SCOPE=col>Character</TH>
<TH SCOPE=col>Entity</TH>
<TH SCOPE=col>Decimal</TH>
<TH SCOPE=col>Hex</TH>
</TR>
</THEAD>
<TBODY>
<TR>
<TD SCOPE=row>Latin small f with hook</TD>
<TD>&fnof;</TD>
<TD>&#402;</TD>
<TD>&#x192;</TD>
</TR>
...
</TBODY>
</TABLE>
The deprecated ALIGN attribute of CAPTION specifies the alignment of the caption relative to the table. Possible values are top (the default), bottom, left, and right.