Table with Caption Template

Properly title your data table with the semantic caption element for improved accessibility and context.

A caption acts as the official heading for your table, clearly describing its contents to all users, including those using assistive technologies.

Screenshot of an HTML table that has a clear title placed directly above the table content.

Get Source Code → Preview →

About the Table Caption

While you can always put a heading element (like h3) above a table, the most semantically correct way to title a table is with the caption tag. This element must be the first child of the table element. Using it programmatically links the title directly to the table it describes. This template provides a clean example of its implementation and styling.

Key Features:

Ideal Use Cases:

Dependencies:

None. This template uses only pure HTML and CSS.

Code

Here's the full code for the table with a caption:

View Output