Lesson 24 of 51 · Module 4, lesson 3 of 6 · 2 min

Description lists

Pair terms with their descriptions, like a glossary or a list of details.

What you'll learn

  • How to write a description list with <dl>, <dt> and <dd>
  • What description lists are good for
  • How to give one term several descriptions

Why this matters

Some content comes in pairs: a word and its meaning, a question and its answer, a label and its value. A description list keeps each pair together, so that the structure is clear to every reader.

A glossary

  • <dl> is the description list.
  • <dt> is a term (the word).
  • <dd> is the description (what it means).
html
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Kitchen words</title>
</head>
<body>
  <h1>Kitchen words</h1>
  <dl>
    <dt>Simmer</dt>
    <dd>Cook gently, a little below boiling, with small bubbles.</dd>

    <dt>Blend</dt>
    <dd>Mix until smooth, usually with a blender.</dd>

    <dt>Season</dt>
    <dd>Add salt, pepper or herbs for flavour.</dd>
  </dl>
</body>
</html>

What you'll see: each word on its own line, with its meaning on the next line, moved in from the left.

The page "Kitchen words": the terms Simmer, Blend and Season, each followed by its description on an indented line below.

Other uses

A description list fits any "label → value" information:

html
<dl>
  <dt>Cooking time</dt>
  <dd>30 minutes</dd>
  <dt>Serves</dt>
  <dd>4 people</dd>
</dl>

It also works for short questions and answers.

Several descriptions

One term can have several descriptions, and several terms can share one:

html
<dl>
  <dt>Tomato</dt>
  <dd>A red fruit, often cooked like a vegetable.</dd>
  <dd>The main ingredient of tomato soup.</dd>
</dl>

Try it yourself

  1. Select the glossary example and choose Try it.
  2. Add two more kitchen words you know, with their meanings.
  3. Make a second list with the details of one dish: time, number of people, difficulty.

Common mistakes

  • Putting <p> or text directly inside <dl>. Only <dt> and <dd> (optionally grouped in a <div>) belong there. Fix: every line is a <dt> or a <dd>.
  • Forgetting the <dt>. A description with no term makes no sense. Fix: pair each <dd> with a <dt> above it.
  • Using <dl> only to indent text. The indentation is a default style. Fix: use it only for pairs.

Check yourself

  1. Which element holds the term? Which holds its description?
  2. Is "Cooking time → 30 minutes" a good use of a description list?
  3. Can one term have two descriptions?

Answers

  1. <dt> holds the term; <dd> holds the description.
  2. Yes — it is a label and a value.
  3. Yes. Add a second <dd> after the first.

Next: when information has rows and columns — a timetable, a price list — you need a table.

Chat with us on WhatsApp