This content originally appeared on Manuel Matuzović - Web development blog and was authored by Manuel Matuzović
…if your divs list content and have classnames like “list” or “list-item”, you want to use a proper list like <ol>
or <ul>
instead.
<div class="list">
<div class="list-item">HTML</div>
<div class="list-item">CSS</div>
<div class="list-item">JS?</div>
</div>
More accessible alternative:
<ul>
<li>HTML</li>
<li>CSS</li>
<li>JS?</li>
</ul>
Explanation
Using lists can have many advantages for screen reader users:
- They can get the total number of items before they interact with the items.
- They may use shortcuts to jump from list item to list item.
- They may use shortcuts to jump from list to list.
- The screen reader may announce the index of the current item (for example, "list item, two of four").
- The elements convey their "list" role
My blog doesn't support comments yet, but you can reply via blog@matuzo.at.
This content originally appeared on Manuel Matuzović - Web development blog and was authored by Manuel Matuzović
Manuel Matuzović | Sciencx (2023-04-22T09:46:54+00:00) lists. Retrieved from https://www.scien.cx/2023/04/22/lists/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.