Live Preview
A table with a caption at the top:
| Month | Sales |
|---|---|
| January | $1,000 |
| February | $1,500 |

By the end of this tutorial, you’ll add accessible table titles with proper placement and CSS styling.
Place <caption> as the first child inside <table>.
One caption per table, before thead, tbody, or row cells.
Use caption-side: top or bottom instead of obsolete align.
Screen readers announce captions with table data for context.
Write concise labels like “Monthly Sales Data” instead of “Table 1”.
Pair captions with thead and scope for full table accessibility.
<caption> Tag?The caption element (<caption>) labels an HTML table with a short, descriptive title. Browsers display it above or below the table (top by default). Each table may have only one caption.
Place <caption> immediately after <table>, before any thead, tbody, tr, th, or td elements.
Captions help all users—including screen reader users—understand what a table shows before reading the cell data.
Place <caption> right after the opening <table> tag:
<table>
<caption>Your Table Caption Here</caption>
<thead>
<tr><th scope="col">Column</th></tr>
</thead>
<tbody>
<tr><td>Data</td></tr>
</tbody>
</table><caption> per <table>.<strong> or <em>.align attribute—use CSS caption-side instead.| Use Case | Code Snippet | Result |
|---|---|---|
| Basic caption | <caption>Sales Data</caption> | Table title above data |
| Caption on top | caption-side: top; | Default position |
| Caption on bottom | caption-side: bottom; | Footnote-style label |
| Bold caption | caption { font-weight: 600; } | Emphasized title |
| With thead | <th scope="col"> | Accessible column headers |
| Avoid | align="top" on caption | Obsolete in HTML5 |
The <caption> element has no required tag-specific attributes in HTML5:
align ObsoleteDo not use. Was used for top/bottom placement. Replace with CSS caption-side.
/* use caption-side instead */class GlobalCSS hook for typography, color, and spacing on the caption text.
class="table-title"id GlobalUnique identifier for styling or scripting the caption element.
id="sales-caption"caption-side CSSCSS property to position caption above (top) or below (bottom) the table.
caption-side: bottom;Global attrs Optionaltitle, lang, and ARIA attributes apply when needed.
lang="en"Content model TextPhrasing content only—plain text or inline elements inside the caption.
Monthly Sales DataStyle captions with the caption CSS selector or a class on the element.
Table caption patterns with copy-ready code, live previews, and hands-on practice.
A table with a caption at the top:
| Month | Sales |
|---|---|
| January | $1,000 |
| February | $1,500 |
A simple table with a caption describing its content.
<table>
<caption>Employee Contact List</caption>
<thead>
<tr><th scope="col">Name</th><th scope="col">Age</th></tr>
</thead>
<tbody>
<tr><td>John</td><td>25</td></tr>
<tr><td>Mary</td><td>30</td></tr>
</tbody>
</table>Use <caption> for data tables, pricing comparisons, schedules, and any tabular content that needs a clear title or summary.
Give data tables meaningful context with a descriptive caption.
<table>
<caption>Monthly Sales Data</caption>
<thead>
<tr><th scope="col">Month</th><th scope="col">Sales</th></tr>
</thead>
<tbody>
<tr><td>January</td><td>$1,000</td></tr>
<tr><td>February</td><td>$1,500</td></tr>
</tbody>
</table>Apply CSS to the caption selector for typography and spacing.
caption {
font-weight: 700;
font-size: 1.1rem;
color: #0f172a;
caption-side: top;
padding: 0.5rem 0;
}Use caption-side: bottom for footnotes or data source notes below the table.
caption {
caption-side: bottom;
font-size: 0.875rem;
color: #64748b;
}Position and style table captions with the caption selector and caption-side:
caption-side: top Default positioncaption-side: bottom Footnote stylefont-weight Emphasize titlecolor / padding Visual polish/* Table caption styling */
caption {
caption-side: top;
font-weight: 600;
font-size: 1rem;
color: #0f172a;
padding: 0.5rem 0;
text-align: left;
}
.table-footnote caption {
caption-side: bottom;
font-size: 0.875rem;
color: #64748b;
}Live styled table caption
| Quarter | Revenue |
|---|---|
| Q1 | $12,400 |
Captions are essential for accessible tables:
th scope="col" headers.Place caption as the first child of table.
Caption appears above or below the table based on caption-side.
Screen readers associate the caption with the table for context.
Users understand what each table contains before reading the data.
The <caption> element is supported in all browsers, including Internet Explorer.
From legacy Internet Explorer to the latest mobile browsers — the caption element is one of the most universally supported table features.
Bottom line: Ship accessible tables with confidence. The <caption> element is safe to use in every production environment today.
The <caption> tag is a small but important element for well-structured, accessible tables. Add a concise caption to every data table and style it with CSS caption-side.
Avoid the obsolete align attribute—use modern CSS for positioning and typography instead.
tablecaption-side for positionalign attribute<caption>Bookmark these before you ship — they’ll make every data table clear and accessible.
<caption> provides a descriptive title for HTML tables.
Must be the first element inside <table>.
Only a single caption is allowed per table element.
ReferenceUse caption-side: top or bottom for positioning.
Screen readers announce captions with table data.
A11yDo not use the HTML align attribute—use CSS instead.
<table>, before any thead, tbody, tr, th, or td elements.align attribute is obsolete. Use CSS caption-side: top or caption-side: bottom.caption-side: bottom.Practice table captions with real data in the Try It editor.
6 people found this page helpful