HTML Description List

HTML description lists are used to display terms, names, and their corresponding descriptions. They are useful for glossaries, dictionaries, FAQs, product details, and technical documentation. Unlike ordered lists and unordered lists, description lists do not display numbered or bulleted items by default.

HTML provides three elements for creating description lists: <dl>, <dt>, and <dd>. These elements help organize related information into a meaningful structure.

What Is an HTML Description List?

An HTML description list is a collection of terms and their associated descriptions. The <dl> element defines the list, the <dt> element specifies a term, and the <dd> element contains its description.

For example, you can use a description list to explain HTML, CSS, and JavaScript on a tutorial website.

HTML Description List Syntax

The following example shows the basic syntax of an HTML description list.

<dl>
    <dt>HTML</dt>
    <dd>HTML defines the structure of a webpage.</dd>

    <dt>CSS</dt>
    <dd>CSS controls the appearance of a webpage.</dd>
</dl>

In this example, HTML and CSS are terms, while their corresponding descriptions explain their purposes.

HTML Description List Example

The following complete HTML example demonstrates how to create a description list.

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>HTML Description Lists</title>
</head>
<body>

    <h1>HTML Description Lists</h1>

    <dl>
        <dt>HTML</dt>
        <dd>A markup language used to structure webpage content.</dd>

        <dt>CSS</dt>
        <dd>A stylesheet language used to style webpages.</dd>

        <dt>JavaScript</dt>
        <dd>A programming language used to add interactivity to webpages.</dd>
    </dl>

</body>
</html>

Save the code as index.html and open it in a web browser. The browser displays each term alongside its description, typically indenting the description.

HTML Description List Elements

HTML uses three elements to create a description list.

HTML ElementDescription
<dl>Defines the description list.
<dt>Specifies a term or name.
<dd>Provides a description or explanation.

You can include multiple terms and descriptions within the same <dl> element. A term can also have multiple descriptions.

Multiple Descriptions for One Term

Sometimes, a single term requires more than one explanation. You can use multiple <dd> elements to describe the same term.

<dl>
    <dt>HTML</dt>
    <dd>HTML stands for HyperText Markup Language.</dd>
    <dd>It defines the structure of webpages.</dd>
</dl>

Here, two descriptions provide different details about HTML.

Styling HTML Description Lists with CSS

You can customize description lists using CSS properties such as color, font-weight, and margin.

<!DOCTYPE html>
<html lang="en">
<head>
    <title>Styled Description List</title>

    <style>
        dt {
            color: #1769aa;
            font-weight: bold;
            margin-top: 12px;
        }

        dd {
            margin-left: 20px;
            margin-bottom: 8px;
        }
    </style>
</head>
<body>

    <h1>Web Development Terms</h1>

    <dl>
        <dt>HTML</dt>
        <dd>Structures webpage content.</dd>

        <dt>CSS</dt>
        <dd>Styles webpage content.</dd>
    </dl>

</body>
</html>

In this example, the terms appear in bold blue text, while the descriptions have additional spacing for readability.

HTML Description Lists vs Other Lists

HTML supports different list types for organizing information.

FeatureDescription ListOrdered ListUnordered List
Main element<dl><ol><ul>
Item elements<dt> and <dd><li><li>
Default markersNoneNumbersBullets
Main purposeTerms and descriptionsSequential itemsRelated items without a required sequence

Choose the list type that best represents your content. Use description lists for terms and explanations, ordered lists for steps, and unordered lists for collections of related items.

Related HTML Tutorials

Continue learning HTML with these tutorials on Web4learners: