<caption> tag is an HTML element that is used to add a title or a brief explanation to a table. It is a child element of the
<table> tag and must be placed immediately after the opening
The content of the
<caption> tag is typically displayed at the top of the table and can be styled using CSS. The caption is usually used to provide a summary or a description of the data presented in the table, which can be helpful for users who are visually impaired and use screen readers to navigate the content.
Here’s an example of how to use the
<caption> tag in HTML:
In the example above, the
<caption> tag is used to provide a title for the table, “Employee Information”. The
<tbody> tags are used to define the header and body of the table, respectively, and the
<td> tags are used to define the cells of the table.