Lists Pt.2

Definition Lists

Not only do we have lists that keep things in order, but we have a list that also helps us define items. Take a dictionary entry for example. You have a word and then you have a definition of the word. It might look something like this:

Web site (also web site or web•site)
noun
a location connected to the Internet that maintains one or more pages on the World Wide Web.

To create a definition list, we use tags different list tag names: <dl> (much like our "ul" name, but this tells us we're creating a "definition list"), <dt> (a definition term), and <dd> (definition description). Another Example:

<dl>
  <dt>Frog</dt>
  <dd>Wet green thing</dd>
  <dt>Rabbit</dt>
  <dd>Warm fluffy thing</dd>
</dl>

You can use multiples of <dt> and <dd> within a definition list:

<dl>
  <dt>Punt</dt>
  <dd>Kick a Ball</dd>
  <dd>Take a Bet</dd>
</dl>

<dl>
  <dt>Color</dt>
  <dt>Colourl</dt>
  <dd>Any hue except white or black</dd>
</dl>

You can also use block level elements in the definition description, such as the <p> and <ul> elements. You cannot use block level elements inside a definition term.

<dl>
  <dt>Frog</dt>
  <dd><p>Wet green thing that croaks.</p></dd>
</dl>

When are definition lists appropriate?

There are two points of view about the use of definition lists. Some people believe that definition lists should only be used for terms and definitions. Others believe that definition lists can be used to tie together any items that have a direct relationship with each other (name/value sets). This second point of view is supported by an example within the W3C specifications:

Another application of DL, for example, is for marking up dialogues, with each DT naming a speaker, and each DD containing his or her words.

ref: MaxDesigns