caption ElementThe caption element is declared by the XHTML 1.1 Tables Module
Elements in the Tables Module are:table | caption | col | colgroup | thead | tfoot | tbody | tr | th | td
The caption element can be used, as the first child of a
table element only, to provide a
caption for the table. You could just use a heading immediately above the table,
but the caption element explicitly links that caption with that table.
You can include inline elements, such as the strong, acronym
and a elements within a caption, but not block-level elements.
For example:
<table>
<caption>Chemical Symbols and Atomic Numbers of the <em>Alkaline Earth Metals</em></caption>
<tbody>
<tr><th scope="col">Element</th>
<th scope="col">Chemical Symbol</th>
<th scope="col">Atomic Number</th>
</tr>
<tr><td scope="row">Beryllium</td> <td>Be</td> <td>4</td> </tr>
<tr><td scope="row">Magnesium</td> <td>Mg</td> <td>12</td></tr>
<tr><td scope="row">Calcium</td> <td>Ca</td> <td>20</td></tr>
<tr><td scope="row">Strontium</td> <td>Sr</td> <td>38</td></tr>
<tr><td scope="row">Barium</td> <td>Ba</td> <td>56</td></tr>
<tr><td scope="row">Radium</td> <td>Ra</td> <td>88</td></tr>
</tbody>
</table>
This table renders as:
| Element | Chemical Symbol | Atomic Number |
|---|---|---|
| Beryllium | Be | 4 |
| Magnesium | Mg | 12 |
| Calcium | Ca | 20 |
| Strontium | Sr | 38 |
| Barium | Ba | 56 |
| Radium | Ra | 88 |
This table is not styled using CSS and so is rendered using your browser's defaults.
The caption-side CSS property can be used to
control the positioning of the caption (in those browsers which support it).
There are no #REQUIRED attributes on the caption element.
There are no specific attributes declared on the caption element.
caption element are listed below:class [ type NMTOKENS ]id [ type ID ]style [ type CDATA ], from the Style Attribute Module (deprecated)title [ type Text ]xmlns [ type URI - #FIXED 'http://www.w3.org/1999/xhtml' ]dir [ type Enumeration (ltr | rtl) ], from the Bi-directional Text Modulexml:lang [ type LanguageCode ]All attributes in the
Events Attribute Collection
are supported:onclick, ondblclick, onmousedown, onmouseup, onmouseover, onmousemove, onmouseout, onkeypress, onkeydown, onkeyup
caption element is:
( #PCDATA | Inline.mix )*
See Content Model & Nesting for information about Content Model syntax and Nesting Groups.
captionabbr, acronym, br, cite, code, dfn, em, kbd, q, samp, span, strong, varabutton, input, label, select, textareaimgb, big, i, small, sub, sup, ttmapnoscript, scriptdel, insbdoobjectrubycaptiontable