A club page may list things to bring or explain registration steps. Both contain items, but only one requires a particular order. HTML lists express this relationship without manually typing bullets or numbers.
Unordered items
ul means unordered list; each item uses li, meaning list item:
<ul>
<li>A book</li>
<li>A water bottle</li>
<li>A notebook</li>
</ul>The browser supplies bullets and indentation. Add another li to add an item; do not use three p elements as the direct items of ul.
Ordered steps
ol means ordered list. It also contains li elements:
<ol>
<li>Read the event information</li>
<li>Fill in the registration form</li>
<li>Collect your seat card</li>
</ol>The browser updates numbering when you insert an item. Do not also type “1.” into the text. When continuing an earlier list, start="4" on ol starts numbering at four; normal lists do not need it.
Nested items and descriptions
To list types of books under a Books item, put a child ul inside that li, then close the outer li. This explicitly connects the child list to its parent item. Close inner elements first.
A description list uses dl with dt for a name or term and dd for its description. It does not use li. Time–Saturday at ten and Place–Reading Center are examples of paired information.
Compare the packing list and registration steps in the Lab. Insert and remove an li to observe automatic numbering. The second example includes a description list so you can compare steps with name–description pairs.
Page experiment: Lists
Compare the examples, then change one part of the HTML using the observation prompt. Compare the source with the real rendered page.
The child ul belongs inside the Books li, showing the item relationship.
The preview uses native browser headings, paragraphs and form controls. Switching examples replaces your edits; Reset lab restores the initial state. Follow in-page links, type and select options. This practice preview does not send form data or run scripts. To try locally, save the complete code as index.html and open it in a browser.
KNOWLEDGE QUIZ
Build it yourself: Lists
Create index.html, write a complete page using the requirements below, then save and open it in a browser. Interact with the page to check it. The reference is one possible implementation; wording may differ.
- Create a ul with three supplies and an ol with three registration steps.
- Nest two subitems inside one supply li and close the child list before the parent li.