HTML <dl> Element
The <dl> tag in HTML is used to define a description list. The <dl> tag is used in conjunction with the <dt> (definition term) and <dd> (definition description) tags to define the terms and descriptions in the list.
Example:
<dl>
<dt>HTML</dt>
<dd>HyperText Markup Language</dd>
<dt>CSS</dt>
<dd>Cascading Style Sheets</dd>
<dt>JS</dt>
<dd>JavaScript</dd>
</dl>
In the above example, we have a description list with three terms and their corresponding descriptions. Each term is enclosed in a <dt> tag, and each description is enclosed in a <dd> tag.
<dl> Tag Attributes:
| Attribute | Description |
|---|---|
compact |
Specifies that the list should be rendered without blank lines between the items |
Here is an example of using the compact attribute:
<dl compact>
<dt>Term 1</dt>
<dd>Description 1</dd>
<dt>Term 2</dt>
<dd>Description 2</dd>
</dl>
By using the compact attribute, the list is rendered without any blank lines between the items.