HTML Lists Tutorial

HTML Lists Tutorial

HTML Lists – ol, ul and dl Tags | TipsInLearning
Lesson 16 of 22

HTML Lists — ol, ul and dl Tags

Learn all three HTML list types — ordered lists, unordered lists, and description lists — with examples, live previews, nested lists, bullet styles, and CSS styling tips.

10 min read
Beginner
SEO Friendly
What You'll Learn
All 3 types of HTML lists
Ordered list <ol> with numbering
Unordered list <ul> with bullets
Description list <dl> <dt> <dd>
Nested lists inside lists
Styling lists with CSS

What are HTML Lists?

HTML lists group related items together. They're essential for navigation menus, step-by-step instructions, bullet points, and glossaries. HTML has three types:

<ol>
Ordered List
Numbered items. Use when sequence matters — steps, rankings.
<ul>
Unordered List
Bullet items. Use when order doesn't matter — features, links.
<dl>
Description List
Term–definition pairs. Use for glossaries and key-value data.

Ordered List — <ol>

<ol> + <li> — Numbered List

The browser auto-numbers each <li> — you never type numbers manually. Use when sequence matters.

HTML — Ordered List
<h3>Steps to Learn HTML</h3>
<ol>
  <li>Learn HTML basics</li>
  <li>Study CSS for styling</li>
  <li>Practice with projects</li>
  <li>Learn JavaScript</li>
</ol>

Steps to Learn HTML

  1. Learn HTML basics
  2. Study CSS for styling
  3. Practice with projects
  4. Learn JavaScript
🌐 Browser auto-numbers each <li> inside <ol>

Ordered List — Number Types

type="" Attribute Values
type=""NumberingExample
type="1"Numbers (default)1. 2. 3.
type="A"Uppercase lettersA. B. C.
type="a"Lowercase lettersa. b. c.
type="I"Roman numeralsI. II. III.
type="i"Lowercase Romani. ii. iii.
HTML — ol type & start
<!-- Uppercase letters -->
<ol type="A">
  <li>HTML</li>
  <li>CSS</li>
</ol>
<!-- Start from 5 -->
<ol start="5">
  <li>This starts at 5</li>
</ol>

Unordered List — <ul>

<ul> + <li> — Bullet List

Each item gets a bullet point (•) by default. Use when order doesn't matter — features, navigation links, ingredients.

HTML — Unordered List
<h3>TipsInLearning Courses</h3>
<ul>
  <li>HTML for Beginners</li>
  <li>CSS Fundamentals</li>
  <li>Bootstrap 5</li>
  <li>JavaScript Basics</li>
</ul>

Bullet Styles

HTML — list-style-type values
<ul style="list-style-type: disc;"><li>Disc (default)</li></ul>
<ul style="list-style-type: circle;"><li>Circle</li></ul>
<ul style="list-style-type: square;"><li>Square</li></ul>
<ul style="list-style-type: none;"><li>No bullet (for nav menus)</li></ul>

Description List — <dl>

<dl> <dt> <dd> — Term & Definition

<dt> = Definition Term (the word/key). <dd> = Definition Description (the meaning). Great for glossaries, FAQs, and key-value data.

HTML — Description List
<dl>
  <dt>HTML</dt>
  <dd>HyperText Markup Language — the standard language for web pages.</dd>
  <dt>CSS</dt>
  <dd>Cascading Style Sheets — used to style web pages.</dd>
</dl>
HTML
HyperText Markup Language — the standard language for web pages.
CSS
Cascading Style Sheets — used to style web pages.
🌐 <dt> is bold; <dd> is indented below

Nested Lists

Place a list inside an <li> to create sub-items:

HTML — Nested Lists
<ul>
  <li>Frontend Development
    <ul>
      <li>HTML</li>
      <li>CSS</li>
      <li>JavaScript</li>
    </ul>
  </li>
  <li>Backend Development
    <ul>
      <li>Node.js</li>
      <li>Python</li>
    </ul>
  </li>
</ul>

Styling Lists with CSS

CSS — Custom Styled List
ul.custom { list-style: none; padding: 0; }
ul.custom li {
  padding: 8px 12px;
  border-left: 4px solid #7c3aed;
  margin-bottom: 6px;
  background: #f3eeff;
  border-radius: 0 8px 8px 0;
}

Pro Tip: list-style: none removes all bullets/numbers. This is the standard technique for building navigation menus from <ul> and <li> elements.

Try It Yourself

Challenge — Build a Course Outline Page
1Create an <ol> of 5 steps to learn web development
2Change it to type="A" — uppercase letters
3Create a <ul> of your favorite websites with list-style-type: square
4Build a <dl> glossary with 4 HTML terms and definitions
5Create a nested list — a <ul> with 2 items, each containing a sub-<ul>
Quick Summary
1<ol> — numbered list; use when order matters
2<ul> — bullet list; use when order doesn't matter
3<dl> + <dt> + <dd> — for glossaries and key-value data
4All list items use <li> — for both <ol> and <ul>
5Nested lists — put <ul> inside an <li> for sub-items
6list-style: none in CSS removes bullets — essential for nav menus

Questions Beginners Ask

Common questions about HTML lists:

When should I use <ol> vs <ul>?
Use <ol> when sequence matters — steps in a tutorial, a ranked top-10, or instructions that must be followed in order. Use <ul> when the items could be listed in any order — a list of features, a navigation menu, or a set of ingredients.
Can I put anything inside a <li> tag?
Yes — <li> can contain almost anything: plain text, links, images, headings, paragraphs, or even other lists. The most common pattern in navigation is <li><a href='...'>Link</a></li>. Nesting another <ul> inside a <li> creates a dropdown sub-menu structure.
How do I remove bullet points?
Add list-style: none in CSS. You'll usually also want padding: 0 and margin: 0 because browsers add default spacing to lists. This is the standard approach for nav menus built from <ul> elements.
When would I actually use a <dl> list?
Description lists are underused but genuinely useful. Real-world uses: glossary pages, FAQ sections (term = question, description = answer), product spec sheets, recipe ingredients with amounts, and any key-value data that doesn't fit neatly into a table or a simple list.
How deep can I nest lists?
There's no technical limit, but stop at 2–3 levels practically. Deeply nested lists become hard to read especially on mobile. If you need 4+ levels, it's usually a sign the information would be better organized as a table or a different structure entirely.

Post a Comment

Previous Post Next Post