Frontend interview practice question

What is the difference between <ol>, <ul>, and <dl>?

HighEasyHtml

Interview quick answer

Choose <ol>, <ul>, and <dl> based on the relationship between items, not just the visual bullet style. The semantic pitfall is using the wrong list type and making steps, grouped items, or term-definition pairs harder for screen readers to interpret.

Interview focus

This HTML interview question tests whether you can explain ol vs ul vs dl: list semantics, accessibility, and common pitfalls, connect it to production trade-offs, and handle common follow-up questions.

  • ol vs ul vs dl: list semantics, accessibility, and common pitfalls explanation without falling back to memorized definitions
  • Lists and Semantics reasoning, edge cases, and production failure modes
  • How you would answer the most likely HTML interview follow-up
Practice more HTML interview questions
Interview answer drill

Use this HTML interview question to rehearse a quick answer, common mistake, follow-up, and production pitfall.

Full interview answer

Overview

HTML gives you <ol>, <ul>, and <dl> because different lists express different relationships. In production, the semantic pitfall is choosing based only on bullets or numbering styles. Screen readers and search engines read these structures differently: <ol> implies sequence, <ul> implies grouping, and <dl> implies term-value meaning.

Tag

Full Form / Meaning

Purpose

Example Output

<ol>

Ordered List

Displays items in a specific sequence (numbered or lettered).

1. Step one
2. Step two
3. Step three

<ul>

Unordered List

Displays items with bullets; order doesn’t matter.

• Item A
• Item B
• Item C

<dl>

Description List

Pairs terms with their definitions (dictionary/FAQ style).

Term → Definition

Differences between the three list elements.

1) <ol> (Ordered List)

Used when sequence matters, like steps or rankings. Each item is wrapped in an <li> tag.

HTML
<ol>
  <li>Boil water</li>
  <li>Add pasta</li>
  <li>Cook for 10 minutes</li>
</ol>
                  

You can customize numbering using attributes:

HTML
<ol type="A" start="3">
  <li>Step A</li>
  <li>Step B</li>
</ol>
                  

Supported type values include 1 (numbers), A/a (letters), and I/i (Roman numerals).

2) <ul> (Unordered List)

Used when order doesn’t matter. Each item is wrapped in an <li> tag.

HTML
<ul>
  <li>HTML</li>
  <li>CSS</li>
  <li>JavaScript</li>
</ul>
                  

You can style bullet types using CSS:

CSS
ul { list-style-type: square; } /* disc | circle | square | none */
                  

3) <dl> (Description List)

Used for name–value pairs such as glossary terms or FAQs. Combine with <dt> (term) and <dd> (definition):

HTML
<dl>
  <dt>HTML</dt>
  <dd>The standard markup language for web pages.</dd>
  <dt>CSS</dt>
  <dd>A stylesheet language for presentation.</dd>
</dl>
                  

Accessibility & Semantics

- <ol> communicates order and hierarchy.
- <ul> conveys grouping without sequence.
- <dl> conveys term–definition relationships.

Using proper list types helps screen readers and search engines interpret your content correctly.

Common Mistakes

- Forgetting <li> tags inside <ul> or <ol>.
- Putting <li> directly inside <dl> (use <dt> and <dd> instead).
- Using <ul> when order actually matters (should be <ol>).

Tag

Meaning

Best Use Case

<ol>

Ordered List

Numbered steps, ranked items, instructions

<ul>

Unordered List

Bulleted lists, navigation menus, unordered items

<dl>

Description List

Terms & definitions, FAQs, metadata key–value pairs

Summary — choose based on whether order, grouping, or term–definition relationships matter.

Still so complicated?

Think of it like this:
- <ol> → a numbered to-do list (order matters).
- <ul> → a grocery list (order doesn’t matter).
- <dl> → a dictionary entry (term with definition).

Guides
Preparing for interviews?

Built in public

The code behind FrontendAtlas lives on GitHub. A star helps other frontend engineers find it.

Star on GitHub