Dev Helpers
← Back

Align numeric table cells to the end

Align numeric table cells to the end with native CSS. The preview includes a small shared demo stylesheet.

Open this example in the interactive library

Source code

<style>
  .demo td:last-child {
    text-align: end;
  }
  .demo td {
    padding: 0.25rem 0.75rem;
  }
</style>
<table class="demo">
  <caption>
    Monthly totals
  </caption>
  <tbody>
    <tr>
      <td>July</td>
      <td>100</td>
    </tr>
    <tr>
      <td>August</td>
      <td>8</td>
    </tr>
  </tbody>
</table>