Techniques for WCAG 2.0

Skip to Content (Press Enter)

-

H39: Using caption elements to associate data table captions with data tables

Applicability

HTML and XHTML data tables

This technique relates to:

Description

The objective of this technique is to programmatically associate captions for data tables where captions are provided in the presentation. The caption for a table is a table identifier and acts like a title or heading for the table.

The caption element is the appropriate markup for such text and it ensures that the table identifier remains associated with the table, including visually (by default). In addition, using the caption element allows screen reading software to navigate directly to the caption for a table if one is present.

The caption element may be used whether or not the table includes a summary attribute. The caption element identifies the table whereas the summary attribute gives an overview of the purpose or explains how to navigate the table. If both are used, the caption should not duplicate information in the summary.

Although WCAG 2.0 does not prohibit the use of layout tables, CSS-based layouts are recommended in order to retain the defined semantic meaning of the HTML and XHTML table elements and to conform to the coding practice of separating presentation from content. If a table is used for layout, the caption element is not used. The purpose of a layout table is simply to control the placement of content; the table itself is “transparent" to the user. A caption would "break" this transparency by calling attention to the table.

Examples

Example 1: An appointment calendar with a caption

Example Code:

<table>
<caption>Schedule for the week of March 6</caption>
...</table> 

Resources

Resources are for information purposes only, no endorsement implied.

Tests

Procedure

  1. Check for layout tables: determine whether the content has a relationship with other content in both its column and its row.

    1. If “no," the table is a layout table.

    2. If “yes," the table is a data table.

  2. If the table is a layout table, check that the table does not include a caption element.

  3. If the table is a data table and it includes a caption element, check that the caption identifies the table

  4. If both a summary attribute and a caption element are present for this data table, check that the summary does not duplicate the caption.

Expected Results

If this is a sufficient technique for a success criterion, failing this test procedure does not necessarily mean that the success criterion has not been satisfied in some other way, only that this technique has not been successfully implemented and can not be used to claim conformance.

Techniques are Informative

Techniques are informative—that means they are not required. The basis for determining conformance to WCAG 2.0 is the success criteria from the WCAG 2.0 standard—not the techniques. For important information about techniques, please see the Understanding Techniques for WCAG Success Criteria section of Understanding WCAG 2.0.