Skip to content
Tutorials Center
My learning

Topics

HTML Reference ยท Tables

The <caption> element

Reference for the HTML <caption> element: giving a table a visible title, where it must go, how screen readers use it, styling tips and technical details.

The <caption> element gives a <table> its title. It tells every reader, sighted or not, what the grid of data is about before they start reading cells. Screen readers announce the caption when the user enters the table, and many let users jump between tables by their captions.

A table can have at most one caption, and it must be the first child of the <table>.

HTML
<table>
  <caption>Ferry departures from Harbor Pier, weekdays</caption>
  ...
</table>

Try it

A captioned table

The second table uses the CSS property caption-side: bottom to place the caption under the grid. The caption stays first in the source, so assistive technology still reads it first.

Attributes

This element has no attributes of its own. It accepts the global attributes. The old align attribute is obsolete; use caption-side and text-align in CSS instead.

Usage notes

  • Always first. The caption must come before any <colgroup>, <thead>, <tbody> or <tr>. If it appears anywhere else, the markup is invalid.
  • Describe the data, not the layout. "Monthly rainfall in Lisbon, 2025 (mm)" is useful; "Table 1" alone is not. Include units or the time period if they apply to the whole table.
  • Longer explanations are fine. A caption holds flow content, so it can contain a short paragraph that explains how to read the table. It cannot contain another table.
  • Inside a figure. When a table is the only content of a <figure>, you can use <figcaption> instead of <caption>. Don't use both for the same title.
  • Better than a heading alone. A heading above the table helps the page outline, but it is not tied to the table. The caption is part of the table, so it travels with it and is announced with it.
  • Accessibility. The caption becomes the table's accessible name, unless aria-label or aria-labelledby overrides it.

Technical summary

Content categories None
Permitted content Flow content, but with no descendant <table> elements
Tag omission The end tag can be omitted if the caption is not immediately followed by ASCII whitespace or a comment
Permitted parents A <table> element, as its first child
Implicit ARIA role caption
DOM interface HTMLTableCaptionElement
Default display table-caption (centered above the table)

Browser support

Supported in every browser.