Dev Helpers
← Back

Keep a caption below its table

Keep a caption below its table with native CSS. The preview includes a small shared demo stylesheet.

Open this example in the interactive library

Source code

<style>
  .demo {
    caption-side: bottom;
  }
  .demo td {
    padding: 0.5rem;
  }
</style>
<table class="demo">
  <caption>
    Weekly totals
  </caption>
  <tbody>
    <tr>
      <td>Monday</td>
      <td>14</td>
    </tr>
    <tr>
      <td>Tuesday</td>
      <td>7</td>
    </tr>
  </tbody>
</table>