Home > Abakada: Back to Basics > Language References > HTML Elements > CAPTION Element
Specifies a caption for the <table> element. | HTML 3.2, 4, 4.01, 5 |
HTML Syntax
<table>
<caption> ... </caption>
...
</table>
NOTE: A <caption
> element’s end tag can be omitted if the caption element is not immediately followed by whitespace or a comment.
The <caption
> element specifies the caption or title of a <table> element.
When present, the <caption
> element’s text should describe the nature of the table.
The caption element is only permitted immediately after the table start tag.
A table element may contain only one caption element.
The <caption>
element has no attribute of its own, but supports global attributes common to all HTML elements.
The following shows how the <caption
> element may be used.
<table>
<caption>This caption will appear above the table.</caption>
...
</table>
This caption will appear above the table.
Header 1 |
Header 2 |
Header 3 |
Cell 1 |
Cell 2 |
Cell 3 |
Cell 4 |
Cell 5 |
Cell 6 |
A table caption by default is center-aligned at the top of a table. The CSS properties text-align and caption-side can be used, though, to align and position the caption.
This example illustrates the concept.
Show me
FIGCAPTION TABLE