HTML Encyclopaedia

The caption tag

The HTML container element

<caption> ... </caption>
is used within the <table> element to provide a table caption.

The contained text is used as a table caption and is centred relative to the table centre.

The tag has a single attribute align which can take the values top or bottom controlling whether the caption appears at the top or bottom of the table. The default value is top.

Here's an example

Some Canadian Provinces
ProvinceCapital
British ColumbiaVictoria
AlbertaEdmonton
SaskatchewanRegina
ManitobaWinnipeg

and here's the HTML
<table  border=5>
<caption align=bottom>Some Canadian Provinces</caption>
<tr><th width=50%>Province<th width=50%>Capital
<tr><td>British Columbia<td>Victoria
<tr><td>Alberta<td>Edmonton
<tr><td>Saskatchewan<td>Regina
<tr><td>Manitoba<td>Winnipeg
</table>


Browsers

All browsers honour this tag in the same way.


See also <table>, <td>, <tr>, <th> and the general notes on tables.