The XHTML WYSIWYG Editor For Desktop & Web Applications

dl

Definition

The dl element is used to create a list where each item in the list comprises two parts: a term and a description. A glossary of terms is a typical example of a definition list, where each item consists of the term being defined and a definition of the term.

Example

In the example below, a definition list contains three items, each containing a term and a definition.

  1. <dl>
  2. <dt>Message Digest</dt>
  3. <dd>A number computed from a set of data that uniquely identifies the data like a fingerprint.</dd>
  4. <dt>Unicode</dt>
  5. <dd>An encoding system that provides a unique number for every character, no matter what the platform, no matter what the program, no matter what the language.</dd>
  6. <dt>Web Services</dt>
  7. <dd>Applications that run on server computers and communicate with other computers using a dialect of <abbr>XML</abbr> called <abbr>SOAP</abbr>.</dd>
  8. </dl>

Multiple terms in a definition list can be defined by the same definition. For example:

  1. <dl>
  2. <dt>Hash Value</dt>
  3. <dt>Message Digest</dt>
  4. <dd>A number computed from a set of data that uniquely identifies the data like a fingerprint.</dd>
  5. </dl>

Any term in the definition list can have multiple definitions. For example:

  1. <dl>
  2. <dt>Key</dt>
  3. <dd>A device used to operate a locking mechanism.</dd>
  4. <dd>A crucial element.</dd>
  5. <dd>Pitch of the voice</dd>
  6. </dl>

Best practice

Definition lists can be used for more than building glossaries. For example, dl can be used for marking up dialogs where dt contains the speaker's name and dd contains the speaker's remarks.

Before using definition lists to mark up other types of content, consider using other constructs, such as headings/paragraphs. For example, the markup below uses definition lists to present a list of news stories:

  1. <h1>Science News</h1>
  2. <dl>
  3. <dt>Space shuttle to lift-off on Tuesday</dt>
  4. <dd>After a two week delay, the space shuttle will deliver the much needed supplies to the international space station.</dd>
  5. <dt>15 new species of fish discovered in the Pacific</dt>
  6. <dd>Scientists are excited by the discovery of 15 new species of fish near the Hawaiian Islands.</dd>
  7. </dl>

Using headings/paragraphs to markup the same content may be preferable. One benefit would be that it would allow the titles of the news stories to appear in the document outline:

  1. <h1>Science News</h1>
  2. <h2>Space shuttle to lift-off on Tuesday</h2>
  3. <p>After a two week delay, the space shuttle will deliver the much needed supplies to the international space station.</p>
  4. <h2>15 new species of fish discovered in the Pacific</h2>
  5. <p>Scientists are excited by the discovery of 15 new species of fish near the Hawaiian Islands.</p>

Attributes

Common core attributes

class
(NameTokens) This attribute assigns a class name or set of class names to an element. Any number of elements may be assigned the same class name or set of class names. Multiple class names must be separated by white space characters. Class names are typically used to apply CSS formatting rules to an element.
id
(ID) This attribute assigns an ID to an element. This ID must be unique in a document. This ID can be used by client-side scripts (such as JavaScript) to select elements, apply CSS formatting rules, or to build relationships between elements.
title
(Text) This attribute offers advisory information. Some Web browsers will display this information as tooltips. Assistive technologies may make this information available to users as additional information about the element.

Common internationalization attributes

xml:lang
(NameToken) This attribute specifies the base language of an element's attribute values and text content.
dir

This attribute specifies the base direction of text. Possible values:

  • ltr: Left-to-right
  • rtl: Right-to-left

Common event attributes

onclick
(Script) A client-side script event that occurs when a pointing device button is clicked over an element.
ondblclick
(Script) A client-side script event that occurs when a pointing device button is double-clicked over an element.
onmousedown
(Script) A client-side script event that occurs when a pointing device button is pressed down over an element.
onmouseup
(Script) A client-side script event that occurs when a pointing device button is released over an element.
onmouseover
(Script) A client-side script event that occurs when a pointing device is moved onto an element.
onmousemove
(Script) A client-side script event that occurs when a pointing device is moved within an element.
onmouseout
(Script) A client-side script event that occurs when a pointing device is moved away from an element.
onkeypress
(Script) A client-side script event that occurs when a key is pressed down over an element then released.
onkeydown
(Script) A client-side script event that occurs when a key is pressed down over an element.
onkeyup
(Script) A client-side script event that occurs when a key is released over an element.

Common style attribute

style
(Text) This attribute specifies formatting style information for the current element. The content of this attribute is called inline CSS. The style attribute is deprecated (considered outdated), because it fuses together content and formatting.

Contains

At least one of the following elements must appear.