What HTML Elements Does a Definition List Have?

An HTML definition list is composed of the following elements:

  • <dl> — this is the container element that encloses the entire definition list;
  • <dt> — this element is used to define a term or a heading;
  • <dd> — this element is used to define a description or definition of the term specified by the <dt> element.

Please note that each <dd> element must be associated with a corresponding <dt> element.

For example, you can create a list of terms and their corresponding definitions using a definition list, in the following way:

<dl>
  <dt>HTML</dt>
  <dd>HyperText Markup Language is the standard markup language used for creating web pages and web applications.</dd>

  <dt>CSS</dt>
  <dd>Cascading Style Sheets is a style sheet language used for describing the presentation of a document written in HTML or XML.</dd>
</dl>

This will produce an output like the following:

HTML
  HyperText Markup Language is the standard markup language used for creating web pages and web applications.
CSS
  Cascading Style Sheets is a style sheet language used for describing the presentation of a document written in HTML or XML.

This post was published by Daniyal Hamid. Daniyal currently works as the Head of Engineering in Germany and has 20+ years of experience in software engineering, design and marketing. Please show your love and support by sharing this post.