Skip to content

Help us create more tutorials! Make a donation using the Donate button or become a member using the button below to hide this banner and track your progress.

Table caption – HTML

Length: 10 minutes

Summary

<table>
  <caption>Insert caption here</caption>
  <!-- Other table code goes here -->
</table>

Details

You can use the caption element to add a caption to a table. The caption element must be the first child inside the table element.

<table>
  <caption>Insert caption here</caption>
  <tr>
    <th>Header 1</th>
    <th>Header 2</th>
    <th>Header 3</th>
  </tr>

  <tr>
    <th>Row Header</th>
    <td>Cell 1</td>
    <td> Cell 2</td>
  </tr>

  <tr>
    <th>Row Header</th>
    <td>Cell 3</td>
    <td>Cell 4</td>
  </tr>
</table>

Demo

Exercises

Try recreating the HTML code from the Demo section. Then try customizing the text inside the caption.

Reference

caption on MDN

Back to: HTML Course > HTML Tables