HTML Description Lists Guide

Learn how to create and style description lists (definition lists) in HTML

What are Description Lists?

Description lists (<dl>) in HTML are used to represent a list of terms and their corresponding descriptions. This element is perfect for:

  • Glossaries and dictionaries
  • Metadata displays (key-value pairs)
  • FAQ sections
  • Product specifications
  • Any content that pairs terms with explanations

Key Features:

  • Semantically associates terms with their definitions
  • Supports multiple descriptions for a single term
  • Flexible styling options with CSS
  • Can be nested or combined with other list types
  • Improves accessibility for term-definition content

Interview & Exam Preparation

Common Interview Questions:

  • What is the purpose of the <dl> element in HTML?
  • How does a description list differ from ordered/unordered lists?
  • When would you use multiple <dd> elements for a single <dt>?
  • How would you style a description list to display horizontally?
  • What are the accessibility benefits of using description lists?

Key Concepts to Remember:

  • Description lists are semantic HTML elements specifically for term-definition pairs
  • They consist of <dt> (term) and <dd> (description) elements
  • Each <dt> can have one or more <dd> elements
  • Modern CSS Grid/Flexbox makes horizontal layouts easy
  • Screen readers understand the term-definition relationship

Basic Description List

Simple term-definition pairs with default styling

<dl> <dt>HTML</dt> <dd>HyperText Markup Language</dd> <dt>CSS</dt> <dd>Cascading Style Sheets</dd> </dl>

Usage: For glossaries, metadata displays, or any term-definition content

Multiple Descriptions

Single term with multiple descriptions

<dl> <dt>JavaScript</dt> <dd>A programming language</dd> <dd>Used for web development</dd> <dd>Runs in the browser</dd> </dl>

Usage: When a term has several definitions or aspects that need explanation

Empty Term

Description list with visually hidden terms

<dl> <dt style="visibility: hidden;">Hidden Term</dt> <dd>This description stands alone visually</dd> <dt style="display: none;">Completely Hidden</dt> <dd>Another standalone description</dd> </dl>

Usage: For visually consistent layouts when terms aren't needed visually

Horizontal Layout

Terms and descriptions displayed in columns

Note: Ideal for contact information or key-value pairs

Card Layout

Description list styled as cards

Note: Great for highlighting categories with their items

Inline Layout

Terms and descriptions displayed inline

Note: Useful for compact metadata displays

Glossary of Terms

Product Specifications

FAQ Section

Nested Description Lists

Description lists within description lists

Usage: For hierarchical term-definition structures

Mixed with Other Lists

Combining description lists with ordered/unordered lists

Usage: When definitions require list structures

Custom Term Indicators

Replacing default styling with custom markers

Note: Allows for creative visual indicators for terms

Bordered Layout

Description list with bordered sections

Note: Creates visual separation between term groups

Description List Playground

Experiment with description lists in our live editor

Description List Examples Preview

Ready-to-use examples covering different use cases

Live Preview

Features Included

Basic Lists
Term-definition pairs
Multiple Descriptions
One term, many definitions
Layouts
Horizontal, card, etc.
Styling
Custom CSS examples

All examples will be loaded into an interactive editor where you can modify and test them

Exam & Interview Preparation

Common Interview Questions

  • Q: What is the semantic purpose of the <dl> element?

    A: The <dl> element is specifically designed for associating terms (<dt>) with their descriptions (<dd>), making it semantically appropriate for glossaries, metadata, and other term-definition content.

  • Q: How would you style a description list to display terms and descriptions side by side?

    A: Using CSS Grid with grid-template-columns: max-content auto; on the <dl> and assigning <dt> to column 1 and <dd> to column 2 creates a clean side-by-side layout.

  • Q: When would you choose a description list over a table for displaying key-value pairs?

    A: Description lists are more semantic for simple term-description relationships, while tables are better for complex data with multiple related values. DLs are also more accessible for screen readers in these cases.

Key Concepts to Remember

  • Semantic Structure: <dl> is for term-description pairs, <ul>/<ol> are for general lists
  • Multiple Descriptions: A single <dt> can have multiple <dd> elements
  • Accessibility: Screen readers announce the relationship between terms and descriptions
  • Styling Flexibility: Modern CSS allows for horizontal, card, and other creative layouts
  • Common Uses: Glossaries, metadata displays, FAQs, and specifications

Practical Scenarios

  • Creating a product specification sheet
  • Building an accessible FAQ section
  • Displaying metadata like author, date, etc.
  • Implementing a glossary of technical terms
  • Showing key-value pairs in a settings panel
< PreviousNext >