Skip to Content

Proper use of tables

Accessibility

Tables can be used to display the kind of information that is appropriate, and that kind of data only. It has to be created in a specific manner to optimize its accessibility.

Reason

Tables can be a difficult feature to navigate on a web page, especially if it does not contain a table header row, or if it is used to lay out content instead of its actual purpose.

Best practice

Here is an example of a properly constructed table with a header row, containing data appropriate to a table.

CourseDepartment
Math 1001Math and Statistics
Statistics 1002Math and Statistics
Environmental Studies 2002Geography and Environmental Studies
History of Math 4004History

Example of less accessible practices

Here are some examples of a bad table.

In this example, we find a table which has no header. It gives no context to someone using a screen reader:

A table constructed with no table header does not allow the screen reader to deliver the information in an organized manner.

(You will notice that this is an image of a table – that is because the table function in cuTheme does not allow for a table to be created without a table header row. Alt text on the image describes the problem with this table.)

This table would not allow easy access to the tabular information.

The second table (also an image) shows a table being used to layout page content using a table:

A table with ordinary page contents looks less pleasing and may be skipped by users with screen readers.

Not only does this add confusion, many users will skip tables with no header row and so any useful/crucial information will be missed. Besides why would you want to lay information out in this way when it could look like this?

Dio

Cat ipsum dolor sit amet, flee in terror at cucumber discovered on floor but cats are fats i like to pets them they like to meow back. Grab pompom in mouth

Ruka

Fluffness ahh cucumber! cats go for world domination scoot butt on the rug. Scream for no reason at 4 am kitty kitty pussy cat doll or destroy couch. 

Additional benefits

What WCAG says

From WAVE: The <th> element helps associate table cells with the correct row/column headers. A <th> that contains no text may result in cells with missing or incorrect header information.

(Be sure to learn more about errors and alerts.)

From WCAG:

“Tables without structural markup to differentiate and properly link between header and data cells, create accessibility barriers. Relying on visual cues alone is not sufficient to create an accessible table.”

Learn more about WCAG says about this issue