<dl> Tag in HTML
The <dl> tag in HTML is used to define a description list. This tag contains a list of terms, marked with the <dt> tag, and their corresponding descriptions, marked with the <dd> tag. The <dl> tag helps structure and group terms and their descriptions logically.
Key Points on <dl> Tag:
- The <dl> tag defines a description list that includes one or more <dt> and <dd> pairs.
- The <dt> tag defines the term, and the <dd> tag provides the description for that term.
- Description lists created using the <dl> tag are ideal for definitions, terms, or any items that need descriptions.
Syntax of <dl> Tag:
Syntax Example
<dl>
<dt>Term</dt>
<dd>Description of term.</dd>
</dl>
Example of <dl> Tag in HTML:
This example demonstrates how to use the <dl> tag to create a description list with terms and descriptions.
Code Example
<dl>
<dt>HTML</dt>
<dd>A markup language used for creating web pages.</dd>
<dt>CSS</dt>
<dd>A style sheet language used to define the presentation of web pages.</dd>
<dt>JavaScript</dt>
<dd>A programming language used to create interactive effects within web browsers.</dd>
</dl>
Output
- HTML
- A markup language used for creating web pages.
- CSS
- A style sheet language used to define the presentation of web pages.
- JavaScript
- A programming language used to create interactive effects within web browsers.
The <dl> tag is highly useful when you need to create structured lists of terms and their corresponding descriptions. It ensures your content is semantically correct and well-structured, providing a better user experience.