Accessible HTML <table>s | Accessibility

Standards Based Development

Oceana Airlines Dinner Service

Class of ServiceAppetizerSaladWineEntreeDessert
EconomyPeanutsNoneComplimentary Soft Drinks, Liquor for PurchaseHam and Cheese SandwichPackaged Cookies
BusinessShrimp CocktailMixed GreensOceana Label Chardonnay or MerlotChicken Satay or Beef TipsNew York Style Cheesecake
FirstBeluga CaviarCaesar, Salad Nicoise, or AntipastoVive Clicquot Vintage Reserve 1990Salmon Basil Cream, Raspberry Balsamic Chicken, Boeuf En DaubeAssorted Belgian Truffles

Travel Expense Report

MealsHotelsTransportsubtotals
San Jose
25-Aug-9737.74112.0045.00
26-Aug-9727.28112.0045.00
subtotals65.02224.0090.00379.02
Seattle
27-Aug-9796.25109.0036.00
28-Aug-9735.00109.0036.00
subtotals131.25218.0072.00421.25
Totals196.27442.00162.00800.27

The Oceana Airlines Dinner Service example above utilizes the summary="" attribute to contain a summary of the way in which the table is layed out - not a summary of the results. summary="" should provide an orientation for a user who will be listening to the table. In other words, when a user is using a screen reader, they will have an overview of the table layout before they start to read it, provided via summary=""

Accessible Tables

Identifying Table Rows and Table Column Information

The example below shows how to associate data cells (td) with their corresponding headers by means of the headers attribute. The headers attribute specifies a list of header cells (row/column labels) associated with the current data cell. This requires each header cell to have an id attribute.

Cups of coffee consumed by each senator
NameCupsType of CoffeeSugar?
T. Sexton 10 Espresso No
J. Dinnen 5 Decaf Yes

The next example associates the same header (th) and data (td) cells as before, but this time uses the scope="" attribute rather than headers="".

scope="" must have one of the following values: row, col, rowgroup, or colgroup. scope="" specifies the set of data cells to be associated with the current header cell. This method is particularly useful for simple tables.

Note: the spoken rendering of this table would be identical to that of the previous example. A choice between the headers="" and scope="" attributes is dependent on the complexity of the table. It does not affect the output so long as the relationships between header and data cells are made clear in the markup.

Cups of coffee consumed by each senator
NameCupsType of CoffeeSugar?
10EspressoNo
5DecafYes

Creating Categories via axis="" Attribute

The following example shows how to create categories within a table using the axis attribute

Travel Expense Report
MealsHotelsTransportsubtotals
San Jose
25-Aug-9737.74112.0045.00
26-Aug-9727.28112.0045.00
subtotals65.02224.0090.00379.02
Seattle
27-Aug-9796.25109.0036.00
28-Aug-9735.00109.0036.00
subtotals131.25218.0072.00421.25
Totals196.27442.00162.00800.27

The example ablove lists travel expenses at two locations: San Jose and Seattle, by date, and category (meals, hotels, and transport). The image shown below displays how a visual user agent might render it. Description of Travel Table.

Travel Expense Report table as rendered by a visual user agent.
Should there be one here? Should this even be a part of a longdesc="" attribute demo?

References and Resources