3 min read · Free · No login needed
Lists group related items together. HTML has three kinds: unordered lists (<ul>) with bullets, ordered lists (<ol>) with numbers, and description lists (<dl>) with terms and their meanings. Each item in the first two is an <li> element.
Use <ul> when the order does not matter: a shopping list, a set of features, a navigation menu. The browser shows a bullet before each item by default.
Use <ol> when the order matters: steps in a recipe, the top 5 of anything, instructions. The browser numbers the items automatically — 1, 2, 3. You can change the numbering with the type attribute (type="A" gives A, B, C; type="i" gives i, ii, iii) and start from any number with start="5".
Use <dl> for name-value pairs: a glossary, a FAQ, or a list of terms. Each term is a <dt> and each description is a <dd>.
A list can sit inside a list item. This is how multi-level menus are built: a <ul> inside an <li> of another <ul>. Just remember to close the inner list before closing the item that holds it.
A list is a group of related items. HTML gives you three kinds: <ul> for items where the order does not matter (a shopping list), <ol> for items where the order does matter (recipe steps), and <dl> for a term and its definition (like a dictionary). Every item in a ul or ol is an <li>, and an li must always sit directly inside the list — never on its own.
| Attribute | Value | Description |
|---|---|---|
type | 1, A, a, I, i | The numbering style: 1, 2, 3 — A, B, C — a, b, c — I, II, III — i, ii, iii. |
start | a number | The number the list starts from. start="5" begins at 5. |
reversed | — | Counts backwards, from high to low. |
Here is an ordered list that starts at 3 and counts with capital letters:
<ol type="A" start="3"> <li>Third item</li> <li>Fourth item</li> </ol>
<dl> for the whole list, <dt> for the term, and <dd> for the description. It is perfect for glossaries and FAQ pages.list-style-type: square; gives square bullets, and list-style-type: none; removes them completely, which is how navigation menus are built.<li> outside a <ul> or <ol> — list items only exist inside a list.<li> — a sub-list must go inside the li it belongs to.<ul> for steps that must be done in order — that is what <ol> is for.<h2>Shopping List</h2> — a heading that splits the page into sections, so the reader knows what the first list is about.<ul> — an unordered list. The order of shopping items does not matter, so the browser shows bullets instead of numbers.<li>Milk</li> — one list item. Every item must sit directly inside the <ul>, never on its own.<ol> — an ordered list. Tea-making steps must be done in order, so the browser numbers them 1, 2, 3 automatically.<!DOCTYPE html>
<html>
<head>
<title>Lists</title>
</head>
<body>
<h2>Shopping List</h2>
<ul>
<li>Milk</li>
<li>Bread</li>
<li>Eggs</li>
</ul>
<h2>Steps to Make Tea</h2>
<ol>
<li>Boil water.</li>
<li>Add tea leaves.</li>
<li>Pour and serve.</li>
</ol>
</body>
</html>
Change the code below and press Run to see the result instantly. No file to save, no login needed.
The questions learners ask most about this lesson — read the question, then open it to see the answer.
ul with bullets when order does not matter, ol with numbers when order matters, and dl for terms and their meanings.
Use ol for steps that must be done in order, such as recipe steps or instructions; the browser numbers them automatically.
Put a list inside an li of another list, and close the inner list before closing the item that holds it.
AI can write code for you, but it cannot think for you. When you learn HTML yourself, your brain builds the real skill: you understand why a page looks the way it does, you can fix it when it breaks, and you can answer it in an exam or an interview without help. That is the skill that gets you a job — not a copied answer.
Finish all 35 lessons, pass the test (80%), pay ₹10 and get your certificate.
Take the testPrefer watching? Video courses teach the same topics step by step.
Free tutorials teach you the basics. Our paid courses add live projects, mentorship and a certificate.
Browse all coursesAsk about courses, website & more
Request human callback:
Please log in to download. You will stay on this page after logging in!
New here? Register now →