Add a Caption to a Table

Description

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><!--  w  w w .j ava2  s .c om-->
<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.





















Home »
  HTML CSS »
    HTML »




HTML Introduction
HTML Document
HTML Section
HTML Group Content
HTML Text Marker
HTML Table
HTML Form
HTML Embed