🚀 LEVEL UP TO SENIOR:Unlock 500+ Advanced Practical Challenges & Exercises.
🎓 COURSERA PARTNER:Earn professional Google, Meta, and IBM certificates to supercharge your resume.
REFERENCEhtml

html Documentation

LOADING ENGINE...

<dl>

AI & DATA SCIENCE // dl-tag

The <dl> element represents a description list — a set of term/description pairs, such as a glossary or metadata list.

Syntax

<dl>
  <dt>HTML</dt>
  <dd>HyperText Markup Language</dd>
</dl>

Deep Dive Course

**`<dl>`** groups pairs of **`<dt>`** (the term being defined) and **`<dd>`** (its definition/description), and browsers indent the `<dd>` by default to visually associate it with the term above. It's the correct semantic choice for glossaries, FAQ lists, metadata (key-value pairs like 'Author: Jane Doe'), or any content structured as 'label, then its value' — a role that plain `<ul>`/`<li>` doesn't capture as precisely.

1Understanding <dl>

`<dl>` groups pairs of `<dt>` (the term being defined) and `<dd>` (its definition/description), and browsers indent the <dd> by default to visually associate it with the term above. It's the correct semantic choice for glossaries, FAQ lists, metadata (key-value pairs like 'Author: Jane Doe'), or any content structured as 'label, then its value' — a role that plain <ul>/<li> doesn't capture as precisely.

💡

A single <dt> can be followed by multiple <dd> elements if a term has more than one description, and multiple <dt> terms can share one <dd> if they mean the same thing.

editor.html
<dl>
  <dt>API</dt>
  <dd>Application Programming Interface</dd>
  <dt>DOM</dt>
  <dd>Document Object Model</dd>
</dl>
localhost:3000

2Practical Example

Here is a real-world application of <dl> showing how it is used in production HTML.

editor.html
<!-- FAQ built with a description list -->
<dl>
  <dt>Is this course free?</dt>
  <dd>Yes, all core lessons are free to access.</dd>
</dl>
localhost:3000

3Best Practices

Follow these guidelines when working with <dl>:

1. Use <dl> for genuine term/description pairs — glossaries, FAQs, key-value metadata

2. Don't use <dl> as a generic two-column layout tool with no real term/definition relationship

3. Pair every <dt> with at least one <dd>

⚠️

Tip: A single <dt> can be followed by multiple <dd> elements if a term has more than one description, and multiple <dt> terms can share one <dd> if they mean the same thing.

editor.html
<dl>
  <dt>API</dt>
  <dd>Application Programming Interface</dd>
  <dt>DOM</dt>
  <dd>Document Object Model</dd>
</dl>
localhost:3000

Examples

Example 01Basic Usage
<dl>
  <dt>API</dt>
  <dd>Application Programming Interface</dd>
  <dt>DOM</dt>
  <dd>Document Object Model</dd>
</dl>
Example 02Advanced Example
<!-- FAQ built with a description list -->
<dl>
  <dt>Is this course free?</dt>
  <dd>Yes, all core lessons are free to access.</dd>
</dl>

Best Practices

  • Use
    for genuine term/description pairs — glossaries, FAQs, key-value metadata
  • Don't use
    as a generic two-column layout tool with no real term/definition relationship
  • Pair every
    with at least one

Interview Question

When is <dl> a better choice than <ul> for an FAQ section?

Hint: Think about the actual relationship between a question and its answer.

An FAQ entry is a term-and-description pair by nature: the question (<dt>) and its answer (<dd>) have a direct, one-to-one associative relationship, which is exactly what <dl> models semantically. A plain <ul><li>Q: ...? A: ...</li></ul> just treats the question+answer as one undifferentiated list item, losing the structural distinction between 'the term' and 'its description' that assistive technology and search engines (which sometimes surface FAQ rich results based on this structure) can otherwise pick up on.

Exercises

EasyPractice using <dl> in a real scenario.
View Solution
<dl>
  <dt>API</dt>
  <dd>Application Programming Interface</dd>
  <dt>DOM</dt>
  <dd>Document Object Model</dd>
</dl>

Frequently Asked Questions

When is <dl> a better choice than <ul> for an FAQ section?

An FAQ entry is a term-and-description pair by nature: the question (

) and its answer (
) have a direct, one-to-one associative relationship, which is exactly what
models semantically. A plain
  • Q: ...? A: ...
just treats the question+answer as one undifferentiated list item, losing the structural distinction between 'the term' and 'its description' that assistive technology and search engines (which sometimes surface FAQ rich results based on this structure) can otherwise pick up on.

Related Functions

dt-tagdd-tag