Two Kinds of Lists
HTML gives you two list containers: <ul> for an unordered (bulleted) list, and <ol> for an ordered (numbered) list. Inside either one, each item goes in its own <li> ("list item") tag.
<ul> — unordered
- HTML
- CSS
- JavaScript
<ol> — ordered
- Plan the page
- Write the HTML
- Style with CSS
- ✓Use <ul> when the order of items doesn't matter — ingredients, features, links.
- ✓Use <ol> when order matters — steps, rankings, instructions.
- ✓Every <li> must live directly inside a <ul> or <ol> — never on its own.
The type & start Attributes
By default, <ol> numbers items 1, 2, 3... You can change both the numbering style and the starting number using two attributes.
<ol type="A" start="3"> <li>Third item, labeled C</li> <li>Fourth item, labeled D</li> </ol>
Default numeric style — 1, 2, 3...
Uppercase letters — A, B, C...
Lowercase letters — a, b, c...
Uppercase Roman numerals — I, II, III...
Lists Inside Lists
To nest a list, place an entire <ul> or <ol> inside an <li> of the outer list — not beside it. This is exactly the "boxes inside boxes" nesting rule from Day 2, applied to lists.
<ol> <li>Set up your tools <ol type="a"> <li>Install VS Code</li> <li>Install a browser</li> </ol> </li> <li>Write your first file</li> </ol>
- Set up your tools
- Install VS Code
- Install a browser
- Write your first file
Placing a nested <ul> or <ol> directly inside another <ul>/<ol> — instead of inside an <li> — breaks the structure. The nested list must always sit inside a list item.
Breaking Down What You Just Learned
<ul>Unordered list — bulleted, used when item order doesn't carry meaning.
<ol>Ordered list — numbered by default, used when sequence matters.
<li>An individual list item — must live directly inside a <ul> or <ol>.
type & startChange an ordered list's numbering style and starting value.
Nested listsA full <ul> or <ol> placed inside a single <li> of the outer list.
Try It Yourself
In day5.html, add an <ol> below your gallery listing three steps you took to build it. Give it type="A" and see how the numbering changes.
Build a Recipe Page
Ingredients and steps, properly listed
Create a new file called day6.html inside your course folder and build a simple recipe page using both list types.
- Start with the full DOCTYPE, html, head, and body structure.
- Add an <h1> with the name of a dish you like.
- Add an <h2> "Ingredients" followed by a <ul> listing at least five ingredients.
- Add an <h2> "Steps" followed by an <ol> listing at least four steps in order.
- Inside one of the steps, nest a <ul> listing two optional add-ins or substitutions.
- Give the ordered list a start value other than 1, and observe how it changes the numbering.
Recap
Unordered lists are bulleted; ordered lists are numbered and imply sequence.
Every list item must sit directly inside a <ul> or <ol>.
Customize an ordered list's numbering style (1, A, a, I) and starting value.
A nested list goes inside an <li>, never directly beside the outer list's items.
Key Takeaways
- <ul> creates bulleted lists; <ol> creates numbered lists.
- Every <li> must be a direct child of a <ul> or <ol>.
- type and start let you customize an ordered list's numbering.
- Nested lists live inside an <li> of the outer list, not beside it.
- Choosing <ul> vs <ol> correctly communicates meaning, not just appearance.