Skip to content

Try our new Crash Courses!

Buy one of our new Crash Courses, now hosted on Teachable.

Table caption – HTML

Length: 10 minutes|

Demo

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>

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 Reference > HTML Tables