From http://www.w3schools.com (Copyright Refsnes Data)

HTML 5 <caption> tag


Definition and Usage

This element defines a table caption. The <caption> tag must be inserted immediately after the <table> tag. You can specify only one caption per table. Usually the caption will be centered above the table.


Differences Between HTML 4.01 and HTML 5

The "align" attribute which was deprecated in HTML 4.01, is not supported in HTML 5. Use CSS instead.


Example

Source Output

<table border="1">
<caption>This is a caption</caption>
<tr>
<td>Cell 1</td>
<td>Cell 2</td>
</tr>
</table>

This is a caption
Cell 1Cell 2


Attributes

Attribute Value Description 4 5
align left
right
top
bottom
How to align the caption. Not supprted. Use styles instead. 4  

Standard Attributes

class, contenteditable, contextmenu, dir, draggable, id, irrelevant, lang, ref, registrationmark, tabindex, template, title

For a full description, go to Standard Attributes in HTML 5.

Event Attributes

onabort, onbeforeunload, onblur, onchange, onclick, oncontextmenu, ondblclick, ondrag, ondragend, ondragenter, ondragleave, ondragover, ondragstart, ondrop, onerror, onfocus, onkeydown, onkeypress, onkeyup, onload, onmessage, onmousedown, onmousemove, onmouseover, onmouseout, onmouseup, onmousewheel, onresize, onscroll, onselect, onsubmit, onunload

For a full description, go to Event Attributes in HTML 5.


Try-It-Yourself Demos

Table with a caption
This example demonstrates a table with a caption.


From http://www.w3schools.com (Copyright Refsnes Data)