Tables

Use tables to present structured data in rows and columns. Tables make it easier to compare and scan information.

Default Table

Tables use a clean design with horizontal borders to separate rows.

MonthRatesAmount
January£85£95,000
February£75£55,500
March£165£125,000
<table class="table">
  <thead>
    <tr>
      <th>Month</th>
      <th>Rates</th>
      <th>Amount</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>January</td>
      <td>£85</td>
      <td>£95,000</td>
    </tr>
    ...
  </tbody>
</table>

With Caption

Use a caption to describe the table's contents.

Dates and amounts of payments
DateDescriptionAmount
1 January 2024Annual licence fee£450.00
15 February 2024Processing charge£25.00
1 April 2024Renewal fee£150.00
<table class="table">
  <caption class="table-caption">Dates and amounts of payments</caption>
  <thead>...</thead>
  <tbody>...</tbody>
</table>

Numeric Data

Right-align numeric data for easier comparison.

CountyPopulationArea (km²)
Avalar45,2001,250
Northern Province32,1002,800
Southern Province28,5001,950
<th style="text-align: right;">Population</th>
<td style="text-align: right;">45,200</td>

With Row Headers

Use <th> in the first column when rows need identification.

ServiceStandardExpress
Passport renewal6 weeks1 week
Driving licence3 weeks5 days
Birth certificate10 days2 days
<tbody>
  <tr>
    <th>Passport renewal</th>
    <td>6 weeks</td>
    <td>1 week</td>
  </tr>
  ...
</tbody>

Complex Table with Scope

Use scope attributes for complex tables to improve accessibility.

Quarterly revenue by region
RegionQ1Q2Q3Q4
North£12,000£15,000£14,000£18,000
South£8,000£9,500£11,000£12,500
<thead>
  <tr>
    <th scope="col">Region</th>
    <th scope="col">Q1</th>
    ...
  </tr>
</thead>
<tbody>
  <tr>
    <th scope="row">North</th>
    <td>£12,000</td>
    ...
  </tr>
</tbody>

Usage Guidelines

Do

  • Use tables for tabular data only
  • Include a caption to describe the table
  • Use scope attributes for complex tables
  • Right-align numeric data
  • Keep tables simple and scannable

Don't

  • Don't use tables for layout
  • Don't add unnecessary columns
  • Don't use tables for simple lists
  • Don't hide important data in middle columns

Accessibility

  • Use <thead>, <tbody>, and <th> correctly
  • Add a <caption> to describe the table
  • Use scope="col" for column headers
  • Use scope="row" for row headers
  • Don't rely on colour alone to convey meaning

CSS Classes

/* Table */
.table { }

/* Caption */
.table-caption { }