HTML caption tag

<caption> tag defines the title or detail of the table. This tag participates in making the model of table. It also provides the table number and the context of the table.

<table class="demoTable">
 <caption>Multiplication table</caption>
 <tr> <th></th> <th>1</th> <th>2</th> <th>3</th> </tr>
 <tr> <td>1</td> <td>1</td> <td>2</td> <td>3</td> </tr>
 <tr> <td>2</td> <td>2</td> <td>4</td> <td>6</td> </tr>
 <tr> <td>3</td> <td>3</td> <td>6</td> <td>9</td> </tr> 
</table>
</>
Multiplication table
1 2 3
1 1 2 3
2 2 4 6
3 3 6 9

Tag Uses

Specific uses of <caption> tag

It defines a title or context of the table.

Tag omission

Both opening and closing tags are necessary for the caption element.

Global Attributes

All the global attributes are applicable on the caption element.



Was this article helpful?