caption

The HTML <caption> element gives a table a title or short explanation. It helps readers understand what the table represents before they explore its cells.

What you will learn

Basic syntax

<table>
  <caption>Weekly study hours</caption>
  <thead>
    <tr><th scope="col">Day</th><th scope="col">Hours</th></tr>
  </thead>
  <tbody>
    <tr><th scope="row">Monday</th><td>2</td></tr>
  </tbody>
</table>

Place caption directly inside table, usually before thead, tbody, or tr. A table can have only one caption.

Write a useful caption

A good caption answers “What is this table about?” in a short phrase. Include the subject, time range, or comparison when that context is important.

Good
Monthly sales by product, April 2026
Too vague
Data does not tell the reader what the numbers mean.

Caption is not a cell

caption describes the table; it is not a row or column heading. Use th for headers and scope or appropriate header associations for complex tables.

CSS can change where the caption appears visually, but its semantic relationship with the table remains. Do not replace it with a disconnected heading when the text is specifically the table’s title.

Common mistakes

Related pages