HTML Tutorial - HTML Table Caption








The caption element lets you define a caption and associate it with a table element.

The align attribute is obsolete.

Example

The following code shows the caption element in use.

<!DOCTYPE HTML>
<html>
<head>
</head><!--from  w ww  .  j ava  2  s . c o  m-->
<body>
  <table>
    <caption>Results of the Survey</caption>
    <tbody>
      <tr>
        <th>Favorite:</th>
        <td>500</td>
      </tr>
    </tbody>
  </table>
</body>
</html>

Click to view the demo

A table can contain only one caption element, but it doesn't have to be the first element contained in the table.