HTML - <caption> Tag


Advertisements


Description

The HTML <caption> tag is used for creating a caption for a table. There could be only one caption per table.

Example

<!DOCTYPE html>
<html>

   <head>
      <title>HTML caption Tag</title>
   </head>

   <body>
      <h2>Cricketers List</h2>
      
      <table width = "100%">
         <caption>Indian Cricketers</caption>
         <th>Name</th>
         <tr>
            <td>Sachin Tendulkar</td>
         </tr>
         <tr>
            <td>M S Dhoni</td>
         </tr>
         <tr>
            <td>Suresh Raina</td>
         </tr>
         <tr>
            <td>Virat Kohli</td>
         </tr>
      </table>
      
   </body>
</html>

This will produce the following result −

Global Attributes

This tag supports all the global attributes described in HTML Attribute Reference

Event Attributes

This tag supports all the event attributes described in HTML Events Reference

Browser Support

Chrome Firefox IE Opera Safari Android
Yes Yes Yes Yes Yes Yes

html_tags_reference.htm

Advertisements