Loading...
HTML <caption> Tag

HTML <caption> Tag

In this tutorial, we will learn about caption tag in HTML with the help of examples.


<caption> Tag

Caption tag <caption> is used for creating a caption for a table.
It must be inserted immmediately after the <table> tag.

Note : <caption> tag can be only used once in a table i.e. one caption per table.

Syntax

<caption>.....</caption>

Example

<!DOCTYPE html>
<html>
  <head>
    <title>caption Tag</title>
  </head>
  <body>
    <table>
      <caption>Students</caption>
      <tr>
        <th>First Name</th>
        <th>Last Name</th>
        <th>Age</th>
      </tr>
      <tr>
        <td>Sunny</td>
        <td>Chaudhary</td>
        <td>20</td>
      </tr>
      <tr>
        <td>Anu</td>
        <td>Chaudhary</td>
        <td>19</td>
      </tr>
    </table>
  </body>
</html>

Output

Students
First NameLast NameAge
SunnyChaudhary20
AnuChaudhary19

Global Attribute

Caption Tag support all the global attributes of HTML.


Event Attribute

Caption Tag support all the event attributes of HTML.


Next Tutorial

We hope that this tutorial helped you develop better understanding of the concept of caption tag in HTML.

Keep Learning : )

In the next tutorial, you'll learn about HTML cite Tag.

- Related Topics