<caption>

Browser
  • IE
  • Cr
  • Sf
  • Fx
  • O

The CAPTION element defines a caption for a table.


<caption>table caption</caption>

The caption text is displayed at the top of the table.

The position where the CAPTION element is placed

The CAPTION element is placed immediately after the TABLE start tag.

Case 1
<table>
<caption>Table caption</caption>
<tr>
<td>Cell</td>
</tr>
</table>
Case 2
<table>
<caption>Table caption</caption>
<tbody>
<tr>
<td>Cell</td>
</tr>
</tbody>
</table>
Case 3
<table>
<caption>Table caption</caption>
<colgroup></colgroup>
<tbody>
<tr>
<td>Cell</td>
</tr>
</tbody>
</table>

Example


<table border="1">
<caption>Table caption</caption>
<tr>
<td>Row1 - Col1</td>
<td>Row1 - Col2</td>
<td>Row1 - Col3</td>
</tr>
<tr>
<td>Row2 - Col1</td>
<td>Row2 - Col2</td>
<td>Row2 - Col3</td>
</tr>
</table>

Output
Table caption
Row1 - Col1 Row1 - Col2 Row1 - Col3
Row2 - Col1 Row2 - Col2 Row2 - Col3