Wikipedia:Manual of Style/Accessibility/Data tables tutorial: Difference between revisions

Content deleted Content added
Column headers: good example 2: no reason to rowspan
m Complex tables: Not just within the table; the HTML 'id' property should be unique on the entire document
Line 276:
When a column header spans two columns, use <code>! scope="colgroup" colspan="2" | </code>. When a row header spans two rows, use <code>! scope="rowgroup" rowspan="2"| </code>.<ref name="H63" group="WCAG"/>
 
For tables with headers that are more complex, it is recommended to simplify the table or split it up into smaller tables. When this isn't possible, you have to associate each cell to their respective header(s) using the "'''id'''" and "'''headers'''" attributes instead of "'''scope'''". On the headers, set the "id" to an unspaced value that is unique withinon itsthe tablepage. On the cells that are described by headers, set the "headers" to a spaced list of the describing "id" values in an order that a screen reader should read them.<ref name="H43" group="WCAG">[https://www.w3.org/TR/2008/NOTE-WCAG20-TECHS-20081211/H43.html "H43: Using id and headers attributes to associate data cells with header cells in data tables"], accessibility level: A</ref> For example, the following markup has the "Company" header describing the "ABC" company (<code>! id="col1" | Company</code> and <code>| headers="col1" | ABC</code>).
 
Below is an example of a complex table with headers that aren't visually clear. Look at the source code of this section to see how each cell's "'''id'''" and "'''headers'''" are defined.