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>

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

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

Event Attributes

onclick, ondblclick, onmousedown, onmouseup, onmouseover, onmousemove, onmouseout, onkeypress, onkeydown, onkeyup
Share this article :
 
Copyright © 2012. Best Online Tutorials | Source codes | Programming Languages - All Rights Reserved