<dl>
A description list: name and description pairs, for example a glossary of terms or technical data.
- Display
- block
- Closing tag
- Required
- Permitted content
- Groups of
<dt>and<dd>elements, optionally wrapped in<div>
Example
#<dl>
<dt>HTML</dt>
<dd>A markup language that describes the structure of a page.</dd>
<dt>CSS</dt>
<dd>Stylesheets responsible for the appearance.</dd>
<dt>JavaScript</dt>
<dd>A programming language that brings a page to life.</dd>
</dl>Definition and usage
#The <dl> element (from description list) groups pairs made of a name and a description. You write the name in <dt> and the description in <dd>. Typical uses are a glossary of terms, a product specification, data in a user profile (“Email”, “City”), or questions and answers.
One name can have several descriptions, and several names (for example synonyms) can share one description. You can also wrap each group in a <div>, which makes styling easier, for example a two-column layout with CSS Grid.
Don’t use <dl> to write dialogue or just to get an indent. The indent of a description is merely the default style of <dd>, which you usually change in CSS anyway.
Syntax
#<dl>
<dt>name</dt>
<dd>description</dd>
</dl>Attributes
#This element has no attributes of its own. It supports the global attributes, such as class, id and hidden.
More examples
#<style>
.course-info div { display: grid; grid-template-columns: 130px 1fr; }
.course-info dt { font-weight: bold; }
.course-info dd { grid-column: 2; margin: 0; }
</style>
<dl class="course-info">
<div>
<dt>Level</dt>
<dd>Beginner</dd>
</div>
<div>
<dt>Duration</dt>
<dd>6 weeks</dd>
</div>
<div>
<dt>Technologies</dt>
<dd>HTML</dd>
<dd>CSS</dd>
</div>
</dl>Default CSS
#Most browsers display this element with these default styles:
dl {
display: block;
margin-block: 1em;
}Browser support
#Widely available
Works in all modern browsers, phones included. You can use it without worry.
- Chrome
- Edge
- Firefox
- Safari
Good practices
#- A name in
<dt>is not automatically a definition. In a glossary, wrap the term in<dfn>to mark that it is defined right here. - Every
<div>inside a<dl>must contain a complete set: at least one<dt>and at least one<dd>. <dt>is not bold by default. If you want to emphasize the names, do it in CSS.
Related entries
#- <dt>A name, term, or question in a `<dl>` description list.
- <dd>The description or value assigned to a `<dt>` name in a description list.
- <ul>A bulleted list in which the order of the items doesn’t matter.
- <ol>A numbered list in which the order of the items matters.
- <dfn>A term being defined at this point in the text, that is, the first, explanatory use of the concept.
Practise it in lessons
#Spotted a mistake or missing an example? Write to us.