Rule n° 245 - Data tables are not simulated.
It may be tempting, to go faster, to scan a table in an office document and paste the image into the web page, but this is actually a very bad idea: the contents of this table will neither be indexable by search engines, nor searchable by different users. To set up a table in a web page, there are specific tags. It is also possible to visually simulate tables by inserting spaces between data. This last solution is to be avoided at all costs.
Goal
- Give users access to tables that are exploitable by their user agents and that can be reproduced in a way that will always be understandable.
- Improve the accessibility of content for people with disabilities.
Solution technique
Systematically use the table element and the associated tr, td, th, caption elements to tag data tables, and not images reproducing the table.
Find out more:
Systematically use the table element and the associated elements tr, td, th, caption, to tag data tables, and not artifices based on accumulations of non-breaking spaces or graphic characters such as pipes (vertical lines "|").
Find out more: table sur MDN
Moyen de contrôle
For each content displayed as a data table (i.e. associating data cells with row or column headers):
- Make sure it is tagged with the
tr(row),td(data cell),th(row or column header) andcaption(table title) HTML elements, for example using a developer tool.