Skip to: content, navigation

by Ian Lloyd

dl (HTML element)

Spec
Depr. Empty Version
No No HTML 2
Browser support full matrix
IE5.5+ FF1+ Saf1.3+ Op9.2+
Full Full Full Full
<dl>
</dl>

Example

In the example below, a definition list is used to format a number of definitions related to the topic of spam:

<dl>
  <dt>Spam</dt>
  <dd>unsolicited email sent in the hope of increasing sales of
      some product, or simply for the purposes of annoying people</dd>
  <dt>Spammer</dt>
  <dd>someone who sends out spam email and therefore deserves to
      develop a nasty incurable disease of some kind</dd>
  <dt>Spam Filter</dt>
  <dd>a tool used in email to 'filter out' likely spam messages,
      usually placing them in a dedicated junk messages folder
      or similar</dd>
</dl>
Type
block-level element
Contains
dt, dd
Contained by
applet, blockquote, body, button, center, dd, del, div, fieldset, form, iframe, ins, li, map, noframes, noscript, object, td, th

Description

If you want to list a series of items that essentially have a title and a description of some kind (that is, each item has two parts), use the definition list dl element. This element contains a series of definition term (dt) and definition description (dd) pairings.

A definition list would display as illustrated in Figure 1.

Figure 1. A description list of spam definition list

You can also nest definition lists, as the example below shows:

<dl>
 <dt>Spam</dt>
 <dd>unsolicited email sent in the hope of increasing sales of some
     product, or simply for the purposes of annoying people
  <dl>
   <dt>Spammer</dt>
   <dd>someone who sends out spam email and therefore deserves to
       develop a nasty incurable disease of some kind</dd>
   <dt>Spam Filter</dt>
   <dd>a tool used in email to 'filter out' likely spam messages,
       usually placing them in a dedicated junk messages folder
       or similar</dd>
  </dl>
 </dd>
</dl>

Without any CSS styles applied, this code would render as shown in Figure 2.

Figure 2. A nested definition list definition list, nested

Use This For …

Typical uses (and hence values) for definition lists include:

  • glossaries, such as the example shown above (term: definition)
  • event listing (title of event: description of event)
  • web site directory (web site name with link: description of web site)

Some people use definition lists for the purposes of marking up dialogues (using dt to denote the speakers, and dd for the words they say). This approach has come straight from the horse’s mouth—the W3C HTML recommendation states that "Another application of dl is for marking up dialogs"—but many people argue that it represents bad practice and is somewhat misguided. You may see definitions lists used in this way, but arguably you shouldn’t use them for this purpose, despite what the W3C says, because they’re designed to mark up lists of definitions.

Compatibility

IE5.5Full
6.0Full
7.0Full
Firefox1.0Full
1.5Full
2.0Full
Safari1.3Full
2.0Full
3.0Full
Opera9.2Full
9.5Full

Every browser listed supports this element type.

In this Section

User-contributed notes

ID:
#1
Date:
Fri, 28 Mar 2008 09:17:37 GMT
Contributed by:
AutisticCuckoo

The content of a DL doesn't have to be *pairs* of DT/DD. It's perfectly valid to have multiple DTs followed by a DD if several terms have the same definition. Or one DT followed by multiple DDs if there are several definitions for that term. Or even multiple DTs followed by multiple DDs.

Add a note

To post a note on this topic, please log in with your SitePoint username and password. If you don't have an account yet, you can create a new account for free.

Related Products

The Principles of Beautiful Web Design

Best Seller!

You don’t need to go to Art School to design great looking web sites!

Book Cover: The Principles of Beautiful Web Design

Download the FREE sample chapters