HTML lists are a fundamental element of HTML semantics. When implemented correctly, they allow assistive technologies to effectively convey how related content is organized, by announcing that items are grouped in a list, the number of items present, and the position of each item in the list.
Conversely, poor use of the <ul>, <ol> and <li> tags can harm the user experience of people browsing with a screen reader, and lead to non‑compliance with accessibility standards such as WCAG, or French references like RGAA and RAWeb.
This article presents several essential rules for implementing HTML lists in a way that is both semantically correct and accessible.
By definition, a list represents a set of elements that share the same nature or participate in the same logical structure.
Examples :
Using a <ul> or <ol> tag to wrap a single element is generally discouraged, because it is inconsistent with the very definition of a list.
<ul>
<li>Terms of use</li>
</ul>
In this situation, using a simple paragraph or another structuring element is often more appropriate.
This type of implementation is tolerated for certain reusable components that usually display several items, but may occasionally show only one (results list, gallery, product cards, etc.).
In that context, keeping the list structure remains relevant, as it preserves component consistency and avoids complex conditional logic in the code or the creation of another component.
The choice between an ordered list (<ol>) and an unordered list (<ul>) should be guided by the logical relationship between the items.
An ordered list is appropriate when the order of the items has intrinsic meaning.
<ol>
<li>Create an account</li>
<li>Validate your email address</li>
<li>Log in</li>
</ol>
An unordered list is appropriate when items are simply grouped, without any notion of sequence or order being necessary for understanding.
Example of good implementation
<ul>
<li>Keyboard accessible</li>
<li>Screen‑reader compatible</li>
<li>Responsive</li>
</ul>
Sometimes, the textual content of items in an ordered list is itself numbered. If this numbering is an integral part of the visible content and is also announced by screen readers, using a <ul> list is acceptable.
WCAG and RGAA do not require the systematic use of an <ol> tag as soon as an order is indicated in another way and is conveyed equally well visually and by screen readers. The important thing is that the logical relationship between the items is properly conveyed to all users.
A common error is to insert elements other than <li> directly inside a <ul> or <ol> container, such as <div>, <p>, <hn>, etc.
<ul>
<div>Item 1</div>
<div>Item 2</div>
</ul>
Or:
<ul>
<p>Description</p>
<li>First item</li>
</ul>
To be accessible, an HTML <ul> or <ol> list must only contain <li> items as direct descendants.
Example of accessible implementation
<ul>
<li>Item 1</li>
<li>Item 2</li>
</ul>
If additional content needs to be associated with an item, it must be included inside the corresponding <li>.
Example of accessible implementation:
<ul>
<li>
<h3>Title 1</h3>
<p>Description of item 1</p>
</li>
<li>
<h3>Title 2</h3>
<p>Description of item 2</p>
</li>
</ul>
This rule guarantees consistent output for screen readers, which rely on this structure.
Another common mistake is to treat the list title as the first list item.
<ul>
<li>Services offered:</li>
<li>Accessibility audit</li>
<li>Training</li>
<li>Support</li>
</ul>
In this example, the screen reader will announce four items, even though only three of them are actually the content of the list.
The title must be implemented outside the list.
Use a heading tag <hn> appropriate for the page’s heading hierarchy.
Example:
<h2>Services offered</h2>
<ul>
<li>Accessibility audit</li>
<li>Training</li>
<li>Support</li>
</ul>
You can also associate the title with its list using the aria-labelledby + id attributes, where the id value is unique in the HTML document.
Example:
<h2 id="services-title">Services offered</h2>
<ul aria-labelledby="services-title">
<li>Accessibility audit</li>
<li>Training</li>
<li>Support</li>
</ul>
We love talking about accessibility! Want to discuss your project?