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

HTML <caption> tag


Example

A table with a caption:

<table border="1">
  <caption>Monthly savings</caption>
  <tr>
    <th>Month</th>
    <th>Savings</th>
  </tr>
  <tr>
    <td>January</td>
    <td>$100</td>
  </tr>
</table>

Try it yourself!


Definition and Usage

The <caption> tag 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.


Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The <caption> tag is supported in all major browsers.


Differences Between HTML and XHTML

The "align" attribute of the caption element was deprecated in HTML 4.01, and is not supported in XHTML 1.0 Strict DTD.


Optional Attributes

DTD indicates in which DTD the attribute is allowed. S=Strict, T=Transitional, and F=Frameset.

Attribute Value Description DTD
align left
right
top
bottom
Deprecated. Use styles instead.
How to align the caption.
TF

Standard Attributes

id, class, title, style, dir, lang, xml:lang

For a full description, go to Standard Attributes.

Event Attributes

onclick, ondblclick, onmousedown, onmouseup, onmouseover, onmousemove, onmouseout, onkeypress, onkeydown, onkeyup

For a full description, go to Event Attributes.


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