This document is in beta. Help us by reporting issues via Github or email.
Make sure that the information, structure and relationships that are conveyed visually (like distinct sections within a page, or a label next to a checkbox) are also identified in code.
For example, when content structures like tables, lists, sections and headings are communicated visually, they should also be coded in ways that assistive technologies can understand.
On this page:
<fieldset>
element to group them together, and a <legend>
element to provide a label for the group.This ensures that the structure of the content that’s conveyed visually by the designs is also available to screen reader, screen magnifier and speech recognition tool users.
Here’s a fun video illustrating the difference this makes for screen reader users.
1.3.1 Info and Relationships: Information, structure, and relationships conveyed through presentation can be programmatically determined or are available in text. (Level A)
See the W3C’s detailed explanation of this guideline with techniques and examples.
<h1> - <h6>
).<h1>
<h2>
<h2>
heading are coded with <h3>
<h1> - <h6>
elements to style text that don’t represent headings for sections of the page.<h1>Main heading for the page</h1>
<h2>Heading for the first top level section of the page</h2>
<h3>Heading for a sub-section, nested under the first top level section</h3>
<h4>Heading for a sub-sub-section, nested under that sub-section</h4>
<h2>Heading for the second top level section of the page</h2>
<h3>Heading for a sub-section, nested under the second top level section</h3>
<h1>Local Weather</h1>
<h2>Today's Forecast</h2>
<h2>Tomorrow Forecast</h2>
<h3>Tomorrow's Allergy Forecast</h3>
<div class="heading">Local Weather</div>
<div class="subheading">Today's Forecast</div>
<div class="subheading">Tomorrow Forecast</div>
<div class="subheading2">Tomorrow's Allergy Forecast</div>
<th scope="row">
;<th scope="col">
;<th scope="rowgroup">
and <th scope="colgroup">
if the same header applies to multiple rows or columns, but you should avoid complex tables like that as they are hard to understand for screen reader users;Cells containing data are coded with <td>
.
Avoid making complex data tables (for example tables containing several rows and/or columns of headers, irregular and multi-level headers).
scope
, id
and headers
attributes.<caption>
element (or aria-labelledby
with the id
of a h1-h6
element directly introducing the table).<table>
<caption>
Short descriptive name for the table
</caption>
<thead>
<tr>
<th scope="col">Column Heading 1</th>
<th scope="col">Column Heading 2</th>
<th scope="col">Column Heading 3</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">Row Heading 1</th>
<td>Cell value for row 2, column 2</td>
<td>Cell value for row 2, column 3</td>
</tr>
<tr>
<th scope="row">Row Heading 2</th>
<td>Cell value for row 3, column 2</td>
<td>Cell value for row 3, column 3</td>
</tr>
</tbody>
</table>
table
s solely used to position items on the screen) should be avoided. Use CSS to position the content instead.role="presentation"
attribute, and should not include the <th>
and <caption>
elements, and the headers
, axis
, scope
and summary
attributes.Lists should be coded with the most appropriate HTML list element:
List mark-up should be used to accurately describe the structure of lists.
<ul>
elements.Content that does not represent a list should not be coded with list mark-up.
<ol>
<li>List value 1</li>
<li>List value 2</li>
</ol>
<dl>
<dt>Title 1</dt>
<dd>List value 1</dd>
<dd>List value 2</dd>
<dt>Title 2</dt>
<dd>List value 1</dd>
</dl>
id
and for
attributes).<label for="first-name">First Name</label> <input name="first-name" />
id
and for
attributes, are grouped together with <fieldset>
and the question preceding each group is coded with <legend>
.placeholder
attribute to provide an ‘Accessible Name’ for a text input
field. (The placeholder
attribute is not well supported by some browsers and assistive technologies combinations, and shouldn’t be used for labelling text fields).Element | What it means | Implicit landmark role |
---|---|---|
<header> |
A section of content that is repeated at the top of all/several pages | role="banner" if it is a direct child of <body> |
<nav> |
An area containing navigation links | role="navigation" |
<search> |
A component that allows users to search content on the site | role="search" |
<main> |
The main content of the page (meaning not header, navigation or footer elements or complementary content) | role="main" |
<form> |
A form | role="form" if it has an Accessible Name |
<section> |
A section of content that you want added in the list of Landmark regions | role="region" if it has an Accessible Name |
<aside> |
Content that complements the content in the main area, but would also make sense on its own |
role="complementary" |
<footer> |
Information about the page (such as copyright) | role="contentinfo" if it is a direct child of <body> |
Make sure that every text node on the page is a descendant of a HTML sectioning element.
If a same HMTL sectioning element and/or equivalent ARIA landmark role
is used multiple times on a page, make sure that each instance has a unique Accessible Name.
<header>
<div id="logo">...</div>
<nav aria-label="BBC">
<ul>
<li><a href="...">News</a></li>
<li><a href="...">Weather</a></li>
<li><a href="...">Sport</a></li>
<li><a href="...">Travel</a></li>
...
</ul>
</nav>
<nav aria-label="News">
<ul>
<li><a href="...">Home</a></li>
<li><a href="...">UK</a></li>
<li><a href="...">World</a></li>
<li><a href="...">Business</a></li>
...
</ul>
</nav>
</header>
<main>
<h1>Pisa rankings: Why Estonian pupils shine in global tests</h1>
...
</main>
<aside>...</aside>
<footer>
<p>BBC 2016</p>
<ul>
...
</ul>
</footer>
<!-- Do not do this -->
<div id="header">
<div id="logo">...</div>
<div id="nav" aria-label="BBC">
<ul>
<li><a href="...">News</a></li>
<li><a href="...">Weather</a></li>
<li><a href="...">Sport</a></li>
<li><a href="...">Travel</a></li>
...
</ul>
</div>
<div id="nav2" aria-label="News">
<ul>
<li><a href="...">Home</a></li>
<li><a href="...">UK</a></li>
<li><a href="...">World</a></li>
<li><a href="...">Business</a></li>
...
</ul>
</div>
</div>
<div id="content">
<h1>Pisa rankings: Why Estonian pupils shine in global tests</h1>
...
</div>
<div id="related_content">...</div>
<div id="footer">
<p>BBC 2016</p>
<ul>
...
</ul>
</div>
This document is in beta. Help us by reporting issues via Github or email.