Unordered list
- Milk
- Eggs
- Bread
- Hummus
Combine the three HTML list types, create nested levels, and generate semantic markup with ul, ol, li, dl, dt, and dd.
Unordered list
<ul>
<li>Milk</li>
<li>Eggs</li>
<li>Bread</li>
<li>Hummus</li>
</ul>Educational guide to HTML lists
Choose ul, ol, or dl according to the relationship between your data. Learn to nest items, continue or reverse numbering, and keep a readable structure beyond its bullets.
Meaning determines the element; the marker only helps present it.
Changing item order does not change the meaning.
The order of steps or positions is part of the meaning.
One or more terms relate to one or more descriptions.
A list expresses a relationship between items. Use ul for materials or resources with no meaningful sequence; ol for instructions, rankings, or a chronology whose order matters; dl for a glossary or name–value data. To compare the same columns across multiple records, a table may express the relationship better. Do not choose a list just to obtain indentation.
A list contains items; each sublist belongs to a particular item.
ul and ol group li items. Write each item inside its li and put a sublist inside the li it belongs to, before the closing tag. You can alternate ul and ol at each level when the meaning changes. An li can contain paragraphs, links, or other flow content; do not put a sublist alongside the li elements or simulate nesting with spaces or br breaks.
Code indentation helps readability, but tags create the hierarchy. In this playground, two spaces per level and the Mixed mode prefixes are a custom input syntax; the lab converts them into HTML. Browsers do not interpret those prefixes as Markdown. Mixed mode preserves the start of each ordered block, while the start/type/reversed controls apply to ol mode.
Change numbering without reordering nodes or writing numbers by hand.
start sets an initial integer, even when type uses letters or Roman numerals: start="4" with type="A" begins at D. ol accepts type="1", "a", "A", "i", or "I". Use this attribute when the ordinal style is part of a reference to the content; for a purely visual preference, use CSS list-style-type. The old type attribute on ul or li is not recommended.
reversed is Boolean: its presence activates descending numbering; reversed="false" activates it too. With an explicit start, it counts down from that value; without one, it starts from the number of items owned by the list. It does not change the DOM or act like flex-direction: column-reverse. li value accepts an integer inside ol and following items continue from it, descending when the list is reversed. HTML allows zero or negative integers; the playground limits start to 1–20. The examples also demonstrate the implicit reversed start and li value.
A relationship can have more than one term or more than one description.
dl groups dt elements followed by dd elements, with no li. Each group contains one or more dt followed by one or more dd; it does not require pairs of exactly two nodes. You can wrap each complete group in a div, as in the example, or place all groups directly inside dl. Use one of these structures consistently and keep each description with its terms.
dl is not limited to dictionary definitions: it also suits metadata or names associated with values. Do not choose it just to draw two columns or for a conversation between speakers. If multiple rows share column headers and you need to compare them, use table. The playground offers one term and one description per line; the example extends that relationship to multiple names or values.
Preserve relationships, reading order, and native actions when changing appearance.
Keep enough markers and indentation to read the levels. The examples adjust spacing and indentation for readability and preserve native markers. Numbers written as text, bullets in ::before, and line breaks do not replace list structure. If an ordinal needs to be a link destination, add a stable id: start or value does not create one.
Avoid routinely adding role="list" to every list. There is an exception to test: Safari may remove ul/ol semantics with list-style: none outside nav. If your design needs to remove markers, MDN documents role="list" as a way to preserve list announcements. These examples keep native markers. Screen readers present dl and its groups differently; do not add term/definition roles by intuition or promise identical counts and navigation everywhere.
A reading list needs neither tabindex nor arrow-key handlers. Links and buttons inside li keep their native keyboard behavior. Do not turn a navigation list into role="menu" just because of its appearance or visually reorder items with CSS in a way that contradicts the DOM. Check enlarged text, nested levels, action focus, both themes, and forced colors.
Check the semantic relationship before correcting markers with CSS.
Tag support does not guarantee identical assistive output.
HTML lists and description lists are Baseline Widely Available. MDN and BCD document support for ul, ol, dl, and start/reversed/type in major browsers. These recipes need no polyfills or JavaScript. Marker styling, pronunciation, and assistive navigation can vary with language, system, browser, and screen reader.
Without supporting styles, the markup keeps its native structure and numbering; without JavaScript, the guide and its examples remain present. Customized markers or counters need their own support and accessibility review. Caption text explains the expected result but does not by itself demonstrate what assistive technology announces.