The <caption> element specifies the title (or caption) of a <table>. It gives the table an accessible name so users can decide relevance before reading every cell.
Put it as the first child of <table>. Write a short, descriptive title — not vague labels like “Table 1.” Style position with CSS caption-side, not HTML align.
Baseline · Widely available.
Not deprecated as an element. Stable across browsers since about July 2015 (and much earlier in practice).
Deprecated attribute.
Do not use align on <caption>. Use CSS caption-side and text-align instead.
Syntax
HTML Syntax
syntax.html
<table><caption>title text</caption> … </table>
<caption> is allowed only as the first descendant of <table>. One caption per table. The end tag may be omitted in HTML if nothing awkward follows, but keeping both tags is clearer for learners.
Reference
Attributes
<caption> has no modern element-specific attributes — only globals, plus one obsolete attribute:
Name the dataset in the caption (what, units, time range when useful).
Avoid empty or vague titles like “Data” or “Table.”
Keep it short — one clear sentence or phrase is enough.
Let headers name columns; the caption names the whole table.
Edge Cases & Pitfalls
Most caption bugs are wrong placement, deprecated align, or weak wording.
order
Must be the first child of table
Do not put <caption> after <thead> or rows. Invalid order breaks the accessibility mapping.
count
Only one caption per table
Extra captions are not valid. Use one clear title for the whole table.
css
Table background skips the caption
background-color on table does not fill caption. Style caption if you need a matching backdrop.
figure
Figure wrapping only a table
If <figure> contains only a table, caption the figure with <figcaption> rather than relying on a nested table caption alone (MDN).
deprecated
Skip align
Use caption-side and text-align. The HTML align attribute on caption is obsolete.
Compatibility
Browser Support
The <caption> element is core HTML for tables in every browser. It is not a Node.js, Deno, or Bun API.
✓ Baseline · Widely available
<caption>
Widely available since about July 2015 (and long before as HTML tables). Chrome, Firefox, Safari, Edge, and Opera all support table captions. Prefer CSS caption-side over the deprecated align attribute.
98%Global support (approx.)
Google ChromeAll
Full support
Mozilla FirefoxAll
Full support
Apple SafariAll
Full support
Microsoft EdgeAll
Full support
OperaAll
Full support
Samsung InternetAll
Full support
Internet ExplorerAll
Supported
<caption>Widely supported
Bottom line: Safe to use on every data table that needs a title. Avoid align; style with CSS caption-side and text-align.
Remember
Key Takeaways
Role:<caption> titles a <table> for people and assistive tech.
Placement: first child of <table>; only one per table.
Text: describe the dataset; avoid vague labels like “Table 1.”
Position: use CSS caption-side, never deprecated align.
One line: a good <caption> is first in the table and names what the data is about.
UA style
Default CSS Settings
Typical user-agent styling for captions (exact rules vary by browser):
Default visual side is the top of the table. Override with caption-side: bottom and adjust text-align / font weight as needed.
Frequently Asked Questions
The caption element gives a table an accessible name or description — a title that sighted users see and screen readers announce with the table.
If present, caption must be the first child of table — before thead, tbody, tfoot, tr, colgroup, or col. Only one caption per table.
No. align is deprecated. Use CSS caption-side (top or bottom) and text-align instead.
caption titles a table. figcaption captions a figure. If a figure only wraps a table, prefer figcaption on the figure rather than nesting caption alone as the figure’s only content (MDN guidance).
No. background-color on table does not paint the caption. Style caption separately if you want matching backgrounds.
Data tables that convey information should have a clear caption (or another accessible name). Decorative layout tables are outdated; use CSS layout instead.