HTML Tutorial

HTML Tag: <caption>

Purpose: Defines the caption of a table.

Usage:

  1. Open the caption with the <caption> tag.
  2. Add the caption text.
  3. Close the caption with the </caption> tag.

Attributes:

  • align: Aligns the caption to the left, right, or center.

Examples:

<caption>Table of Contents</caption>
Tag Example:
<table>
  <caption>Employee List</caption>
  <thead>
    <tr>
      <th>Name</th>
      <th>Department</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>John Doe</td>
      <td>Sales</td>
    </tr>
  </tbody>
</table>

Output:

Name Department
John Doe Sales