HTML and XHTML data tables
This technique relates to:
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.
Example Code:
<table>
<caption>Schedule for the week of March 6</caption>
...</table>
Resources are for information purposes only, no endorsement implied.
HTML 4.01 Table Captions: The CAPTION element
Check for layout tables: determine whether the content has a relationship with other content in both its column and its row.
If “no," the table is a layout table.
If “yes," the table is a data table.
If the table is a layout table, check that the table does not include a
caption
element.
If the table is a data table and it includes a caption
element, check
that the caption
identifies the table
If both a summary
attribute and a caption
element are present
for this data table, check that the summary
does not duplicate the
caption
.
For layout tables, #2 is true.
For data tables, #3 and #4 are true.
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—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.