HTML lists
HTML Living Standard
The list element tells the browser whether items form a sequence, an unordered group, or a set of names and descriptions.
On this page
What is a list item?
An li represents one item. Put each item in its own pair of li tags and place them inside the list element. ul wraps the whole group in this example.
How to try it In index.html, replace the content between <body> and </body> with this example. Save the file and reload it in the browser.
<ul>
<li>Pen</li>
<li>Notebook</li>
</ul>
What to expect Pen and Notebook appear as two items. Try adding another li before </ul>.
Ordered lists <ol>
Use ol when rearranging the items would change their meaning, such as a recipe or a set of instructions. Each item is an li. The browser normally adds numbers in order.
How to try it In index.html, replace the content between <body> and </body> with this example. Save the file and reload it in the browser.
<ol>
<li>Choose a product.</li>
<li>Pick a size.</li>
<li>Review your order.</li>
</ol>
What to expect The browser displays three numbered steps. Add an li between two steps and their numbers adjust automatically.
Unordered lists <ul>
Use ul for a group of related items where their order does not change the meaning. The browser usually draws a bullet for each li. To create a nested list, place it inside the li it belongs to.
How to try it In index.html, replace the content between <body> and </body> with this example. Save the file and reload it in the browser.
<ul>
<li>Pen
<ul>
<li>Blue pen</li>
<li>Black pen</li>
</ul>
</li>
<li>Notebook</li>
</ul>
What to expect Pen and Notebook have bullets at the outer level. The two pen colors appear indented under Pen.
Description lists <dl>
Use dl for name–description pairs. Write the name in dt and its description in dd. A group can have multiple names or descriptions. Glossaries and item specifications are common uses.
How to try it In index.html, replace the content between <body> and </body> with this example. Save the file and reload it in the browser.
<dl>
<dt>Viewport</dt>
<dd>The visible area of a web page.</dd>
<dt>Alt text</dt>
<dd>A text alternative for an image.</dd>
</dl>
What to expect Each name appears with its description beneath it. Browsers usually indent the descriptions.