You are here:

  1. Manual
  2. Development
  3. Tables
  4. Relational information
  5. Accessibility

Tables: Accessibility and tables

A table is a handy, but often complex type of information. The visitor needs to take trouble to see all the pieces of information in the table in their relationships with one another. For visitors who are blind, this is an even bigger challenge. After all, they have to rely on a mental image of the table, since they cannot visualise it. Web developers and content managers can enhance the accessibility of tables for this group of visitors.

Screen readers and Braille displays work their way through a table step-by-step, from beginning to end. Without intervention by the user, such programmes will pass through the content cell-wise. If the programme can determine the labels for a column or a row, these can be associated with the individual cells.

Users can also ask the programme for the content of a specific cell. For instance, ‘The number of participants to the activity Urban renovation info evening.

The most important forst step toward accessibility has already been made: the use of cells for information (td) and cells for labelling (th).

Associating table labels with rows or columns: the scope attribute

Table header (th) cells constitute a label for both a row and a column. Visually, it is possible to discriminate whether the label refers to a column or a row, but this is less clear if the table is presented step-by-step, (serially). This is why the scope attribute was invented. When added to a th cell, this attribute tells the screen reader or Braille display that the label should be associated with a row or a column.

Use the scope attribute to associate table labels (th cells) with columns or rows.

Guideline R-pd.11.4

Application of the scope attribute (HTML)

<th scope="col">Activity:</th>

Web developers and content managers who produce tables containing relational information should make use of the scope attribute on table labels whenever possible.

This attribute can also be applied to cells covering several columns or rows. In this case, several rows or columns will be associated with the label.

Table labels and complex associations: the headers attribute

The use of the scope attribute will usually be sufficient for the association of table labels with columns or rows. Sometimes, however, the construction is so complex that this attribute no longer suffice. In this case, an explicit relationship can be stated between specific cells and table labels using the headers attribute and the id attribute.

The id attribute to the th cell.

The headers attribute to cells that are to be associated with the th cell(s). The headers attribute contains one or more values - the values of the id attributes on the th cells - separated by spaces.

Example of a construction using the headers attribute (HTML)

<th id="activity">Activity:</th>
...
<th id="location">The Hague and surroundings:</th>
...
<td headers="activity location"
•	 European relations info day
</td>

Use the header and id attributes to associate table labels (th cells) with individual cells in complex tables.

Guideline R-pd.11.5

Again, the application of this technology is only necessary if the scope attribute is does not answer the web developer’s or content manager’s needs. The use of headers and id attributes for making explicit associations is a complex, demanding task. In view of the workload involved, it is not that suitable for tables that have to be modified or expanded regularly.

If so desired, the scope attribute can be combined with the headers and id attribute.

Abbreviating table labels

Sometimes, table labels can become quite long, for instance 'Work in the Randstad conurbation and surrounding area'. This can prove confusing or annoying for a user if the screen reader or Braille display presents this label for every cell associated with it. th cells can be given the abbr attribute, to which an abbreviated version of the label can be annoyance.

Provide abbreviations for table labels (th cells) by means of the abbr (abbreviation) attribute if the content of the table label is so long that repetition in a speech browser could cause irritation.

Guideline R-pd.11.6

Example of the abbr attribute on a th cell (HTML)

<th abbr="Work in the Randstad">
Work in the Randstad conurbation and surrounding area
</th>

Summarising the content of tables

Sighted visitors can see at a glance what a table is about. This is not the case for users who are blind. By means of the summary attribute on the <table> tag, it is possible to provide blind users (and also search spiders) with a brief description of a table.

The summary attribute (HTML)

<table summary="A schedule of the international activities of the municipality of The Hague for the next 6 months">

Tables and titles

Not every table needs a summary. A good heading above a table can be just as descriptive, both for blind and sighted users. A heading element can be used for this (h1 through h6), but there is also an element that has been made specially for tables: the caption element. Always place caption markup immediately after the <table> tag.

The caption element, immediately after the <table> tag (HTML)

<table>
<caption>Schedule of international activities</caption>
<tr>
...

Use the caption element or heading markup to provide a heading above a table.

Guideline R-pd.11.7


Web Guidelines version 1.3, November 2007.