Skip to main content

HTML Tags

HTML <dl> Tag

Written by Updated HTML <dl> Tag exercises

The dl tag makes a description list: terms and what they mean. dt is each term and dd its description. Glossaries, FAQs and product specifications ("Weight: 1.2 kg") are all natural description lists.

It is the least known of the three list types. All three are compared in HTML Lists, which covers description lists alongside the other two.

Syntax

html

<dl>
  <dt>Term 1</dt>
  <dd>Description of Term 1</dd>
  <dt>Term 2</dt>
  <dd>Description of Term 2</dd>
</dl>

None of the three tags has attributes of its own; global attributes such as class and id work.

Example

html

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Description List Example</title>
  <style>
    dl {
      padding: 15px;
      width: 320px;
    }
    dt {
      font-weight: bold;
      color: #222;
      margin-top: 10px;
    }
    dd {
      margin-left: 20px;
      color: #555;
      margin-bottom: 5px;
    }
  </style>
</head>
<body>
  <h2>HTML Terminology</h2>
  <dl>
    <dt>HTML</dt>
    <dd>HyperText Markup Language – the standard language for creating web pages.</dd>

    <dt>CSS</dt>
    <dd>Cascading Style Sheets – used to style and layout web pages.</dd>

    <dt>JavaScript</dt>
    <dd>A scripting language used to create dynamic and interactive effects on web pages.</dd>
  </dl>
</body>
</html>

Each term, HTML, CSS and JavaScript, appears on its own line, with its description indented below it.

More than one of each

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

Flexible pairs

html

<dl>
  <dt>Colour</dt>
  <dt>Color</dt>
  <dd>The look of light reflected by an object.</dd>

  <dt>Size</dt>
  <dd>Small</dd>
  <dd>Medium</dd>
  <dd>Large</dd>
</dl>

You may also wrap each term-and-description group in a <div> inside the <dl>, which makes them easier to style as cards or rows.

Browser Support

Chrome
Edge
Firefox
Safari
Opera
IE9+
YesYesYesYesYesYes

Good to know

  • Only <dt>, <dd> and wrapping <div>s are allowed directly inside <dl>.
  • Remove the indent with dd { margin-left: 0; }, or lay terms and descriptions side by side with CSS Grid.

HTML <dl> Tag exercises

Define a term

Make a description list with one term, HTML, and its description, The language of web pages.

Result

Check your answer to see it here.