11.2 Mark-up for data and header cells in tables
The New Zealand Web Standards 2.0 were released in March 2009 and replace the previous version, the New Zealand Government Web Standards 1.0 (below). See Meeting the standards for more information.
The Standard
11.2 For data tables that have two or more logical levels of row or column headers, use markup to associate data cells and header cells.
Guide to this standard
There are two techniques for providing the association between header and data cells:
- The "scope" attribute on a <TH> cell specifies the set of data cells for which that <TH> cell provides header information. The "scope" attribute can have values of "row", "col", "rowgroup" or "colgroup".
- The "id" and "header" attributes on <TH> and <TD> cells. The "header" attribute on a cell specifies a list (separated by spaces) of the names of header cells that provide header information for that cell; those names are set by adding "id" attributes to the header cells.
For very complex tables, inconsistencies in the way assistive technologies interpret the scope attribute mean that a 'belt and braces' approach to ensuring accessibility of the table is to use both the "scope" and the "id" and "headers" approaches in the table mark-up.
Complex tables, such as the HTML versions of the printed financial statements from an agency’s annual report, cannot readily be simplified for the web, because they still need to retain their structural integrity in order to be interpreted properly (as financial statements) by sighted users. Use of "id" and "header" attributes at least on <TH> and <TD> cells can ensure that such tables are reasonably accessible for users of assistive technologies as well.
This standard covers the W3C WAI checkpoint 5.2 for NZ government agencies.
Rationale for this standard
Users who rely on assistive technologies, particularly those with visual impairments, can either not see, or have difficulty seeing the structure of a table. In such cases, using mark-up to associate data cells with header cells enable the assistive technology device to describe to the user the structure of a table.
