Definition
The <dl>
HTML element is used to create a description list in a web page. It is typically used to present a list of terms and their corresponding descriptions or definitions.
Here’s an example of how to use the <dl>
element:
<dl>
<dt>Term 1</dt>
<dd>Description 1</dd>
<dt>Term 2</dt>
<dd>Description 2</dd>
<dt>Term 3</dt>
<dd>Description 3</dd>
</dl>
In this example, the <dl>
element wraps a series of term-description pairs. Each term is represented by a <dt>
element, which stands for “definition term,” and each description is represented by a <dd>
element, which stands for “definition description.” The terms and their corresponding descriptions are semantically associated within the <dl>
container.
The <dl>
element is useful for presenting glossaries, metadata, or any content where a term and its definition need to be paired together. It provides a clear and structured way to present information.
It’s important to note that the <dl>
element does not imply any particular visual styling by default. It’s up to the CSS styles applied to the <dl>
, <dt>
, and <dd>
elements to determine their appearance, such as indentation, font size, or spacing.