<dl> Tag Syntax

Rules for coding HTML dl elements
<body>
   ... flow content expected ...
   <dl>
      ...
      <dt>... phrasing content ...</dt>
      <dd>
         ... flow content ...
      </dd>
      ...
   </dl>
   ...
</body>

Make sure you understand the difference between a tag and element and are familiar with the definitions of namespace and other HTML terms.

  1. Include a dl element where flow content is expected.
  2. Begin the dl element with a starting <dl> tag. The element name uses lower case letters and should be in the HTML namespace, which it will pick up automatically from the xmlns attribute on the <html> tag.
  3. Inside the dl element, between the <dl> starting tag and the </dl> ending tag, code the li elements for the list items.
  4. End the dl element with a matching </dl> closing tag.
Content of the dl element

The content of the dl element can only include HTML comments, dt elements and dd elements.

Validation Errors

If the dl element is used where phrasing content is expected, the W3C Markup Validation Service will report an error like this:

Line line#, Column col#: HTML element dl not allowed as child of HTML element element in this context. Contexts in which element dl may be used: Where flow content is expected. Content model for element element: Phrasing content.

Other tools that validate HTML code may report a similar error. In electronic publishing, for example:

element "dl" from namespace "http://www.w3.org/1999/xhtml" not allowed in this context

To resolve this type of error, move the dl element and its inner HTML inside one of the HTML elements where flow content is allowed.

The inner HTML code of the dl element must include at least one dt element and at least one dd element. If either one is missing the W3C Markup Validation Service will report an error like this:

Line line#, Column col#: HTML element dl is missing a required instance of child element dt [or dd] Content model for element dl: Zero or more groups each consisting of one or more dt elements followed by one or more dd elements.

To resolve this type of error, add the missing element(s) to the inner HTML of the dl element.