The following attributes are deprecated and should not be used. They are documented below for reference when updating existing code and for historical interest only.
Specifies on which side of the table the caption should be displayed. The possible enumerated values are left, top, right, or bottom. Use the caption-side and text-align CSS properties instead, as this attribute is deprecated.
If included, the <caption> element must be the first child of its parent
element.
When a <table> is nested within a as the figure's only content, it should be captioned via a for the <figure> instead of as a <caption> nested within the <table>.
Any background-color applied to a table will not be applied to its caption. Add a background-color to the <caption> element as well if you want the same color to be behind both.
This example demonstrates a basic table that includes a caption describing the data presented.
Such a "title" is helpful for users who are quickly scanning the page, and it is especially beneficial for visually impaired users, allowing them to determine the table's relevance quickly without the need to have a screen reader read the contents of many cells just to find out what the table is about.
HTML
A <caption> element is used as the first child of the
, with text content similar to a title to describe the table data. Three rows, the first being a header row, with two columns are created using the