| Sales | January | February |
| New Cars | $23,345 | $25,456 |
| Used Cars | $32,456 | $23,678 |
| Accessories | $2,345 | $3,567 |
In the example above, the cells of the Table are left without any coding to help the AT Device know what the numbers mean.
The standards call for the following:
1. Designate row and column headers using the <th> tag. This is accomplished by
changing the tags in the top line from <td> to <th> and make the table look like
this:
| Sales | January | February |
|---|---|---|
| New Cars | $23,345 | $25,456 |
| Used Cars | $32,456 | $23,678 |
| Accessories | $2,345 | $3,567 |
The code underneath now looks like this:
<tr>
<th>Sales</th>
<th>January</th>
<th>February</th>
</tr>
Sometimes you can get away with only this change. If, as in the case of our Data Table above, you have multiple rows, you need to use the next standard
This is accomplished with the use of Scope attribute and making the first
column also into headers <th>. Note that we can fix the layout later with CSS to
make it look better.
| Sales | January | February |
|---|---|---|
| New Cars | $23,345 | $25,456 |
| Used Cars | $32,456 | $23,678 |
| Accessories | $2,345 | $3,567 |
There is an alternative method for this standard which is used in complex Data Tables. Please see the WebAIM Tutorial for information on how to use Headers and IDs
<caption> tag.
We now should add a Caption tag to our table to make it more understandable to folks with AT devices.
| Sales | January | February |
|---|---|---|
| New Cars | $23,345 | $25,456 |
| Used Cars | $32,456 | $23,678 |
| Accessories | $2,345 | $3,567 |
The last three standards are:
The first two of these we covered in Layout Tables. In this case, the Summary statement would provide pretty much the same information as the Caption. I've added this to the last table above.
The last standard is a recommendation to avoid what we might refer to as "merged cells." While this might actually be more commonplace in Layout Tables they do creep up from time to time in complex Data Tables. My advice, try to see if you can break up one complex table into several smaller tables. For more information and advice on this, see the WebAIM Tutorial.
Return to Accessible Web Design page