HTML <caption> Tag

<caption> tag is used to give a title for a table.

We must put <caption> tag just after <table> tag.

The <caption> tag comes in pairs.

We must write the content between the opening (<caption>) and closing (</caption>) tags.

As looking, it will be placed at the top of the table.

Check the code below:

<table summary="grades" width="400" border="1">
   <caption>Mathematic Grades</caption>
         <th>1st Exam</th>
         <th>2nd Exam</th>
         <td>Tigran Aleksanyan</td>
         <td>Armine Kocharyan</td>
         <td>Hasmik Sargsyan</td>

Check how it looks as a result:

As you can see; "Mathematic Grades" is a title which is written via <caption> tag and it is placed at the top of the table.


This tag use the Global Attributes and there is one attribute below which is not supported anymore by HTML5.

Attributes Values Description
align right
It was used to align the content inside cells.
This attibute is not supported by HTML5