HTML tagTables

<caption>

The title of a table, placed as the first element inside `<table>`.

Display
table-caption
Closing tag
Required
Permitted content
Flow content without tables
On this page

Example

#
HTML
<style>
  table { border-collapse: collapse; }
  th, td { border: 1px solid #8886; padding: 4px 10px; text-align: left; }
  caption { padding-bottom: 6px; font-weight: bold; }
</style>
<table>
  <caption>Study plan for this week</caption>
  <tr><th scope="col">Day</th><th scope="col">Topic</th></tr>
  <tr><td>Monday</td><td>Lists and tables</td></tr>
  <tr><td>Wednesday</td><td>Forms</td></tr>
  <tr><td>Friday</td><td>Mini project</td></tr>
</table>
Preview

Definition and usage

#

The <caption> element gives a table a title that says what it contains: “September class schedule”, “Plan comparison”, “Quiz results”. It must be the first child of the <table> element.

By default the browser displays the caption centered above the table. If you’d rather have it below, use CSS: caption-side: bottom.

The caption matters for accessibility. A screen reader announces it as the table’s name when the user enters the table, so they immediately know whether they need it. When a table is the only content of a <figure> element, you can use <figcaption> instead of <caption>.

Syntax

#
Syntax
<table>
  <caption>Table title</caption>
  …
</table>

Attributes

#

This element has no attributes of its own. It supports the global attributes, such as class, id and hidden.

Default CSS

#

Most browsers display this element with these default styles:

CSS
caption {
  display: table-caption;
  text-align: center;
}

Browser support

#

Widely available

Works in all modern browsers, phones included. You can use it without worry.

  • Chrome
  • Edge
  • Firefox
  • Safari

Good practices

#
  • Write the caption specifically. “Table 1” says nothing, while “Course prices in 2026” says it all.
  • Change the caption’s position with the caption-side property, not with the obsolete align attribute.

Related entries

#

Spotted a mistake or missing an example? Write to us.