Caption Positioning

This example demonstrates how to set the position of the table caption:

HTML file: Displayed by browser:
<style>
table, td, th {
    border: 1px solid black;
}
caption {
    caption-side: bottom;
}

</style>
<body>
<table>
<caption>Table 1.1 Customers</caption>
  <tr>
    <th>Company</th>
    <th>Contact</th>
    <th>Country</th>
  </tr>
  <tr>
    <td>Alfreds Futterkiste</td>
    <td>Maria Anders</td>
    <td>Germany</td>
  </tr>
  <tr>
    <td>Berglunds Snabbköp</td>
    <td>Christina Berglund</td>
    <td>Sweden</td>
  </tr>
  <tr>
    <td>Centro Comercial Moctezuma</td>
    <td>Francisco Chang</td>
    <td>Mexico</td>
  </tr>
  <tr>
    <td>Ernst Handel</td>
    <td>Roland Mendel</td>
    <td>Austria</td>
  </tr>
  <tr>
    <td>Island Trading</td>
    <td>Helen Bennett</td>
    <td>UK</td>
  </tr>
</table>

<p><b>Note:</b> IE8 supports the caption-side property if a !DOCTYPE is specified.</p>
</body>
Table 1.1 Customers
Company Contact Country
Alfreds Futterkiste Maria Anders Germany
Berglunds Snabbköp Christina Berglund Sweden
Centro Comercial Moctezuma Francisco Chang Mexico
Ernst Handel Roland Mendel Austria
Island Trading Helen Bennett UK

Note: IE8 supports the caption-side property if a !DOCTYPE is specified.

Note: You can only place the caption on the top or bottom.

Back button Table of Contents Next button