HTML <dd> Tag โ Definition Description
๐ Introduction
The <dd> tag is used to define the description or explanation of a term inside a description list (<dl>).
It works together with:
<dt>โ the term (title)<dd>โ the description (meaning)
๐งฑ Syntax
<dl>
<dt>HTML</dt>
<dd>Used to structure web pages</dd>
</dl>
๐ก Example
<!DOCTYPE html>
<html>
<head>
<title>DD Example</title>
</head>
<body>
<h2>Programming Terms</h2>
<dl>
<dt>HTML</dt>
<dd>Creates the structure of a webpage</dd>
<dt>CSS</dt>
<dd>Styles and designs the webpage</dd>
<dt>JavaScript</dt>
<dd>Adds interactivity and logic</dd>
</dl>
</body>
</html>
๐ฅ๏ธ Output Explanation
<dt>shows the term<dd>shows the explanation- Together they form a structured definition list
๐ฏ When to Use <dd>
Use <dd> for:
- Definitions
- Explanations
- Key-value details
- FAQ answers
Example:
<dl>
<dt>API</dt>
<dd>A way for programs to communicate with each other</dd>
</dl>
๐ง Important Rule
๐ <dd> must always be inside <dl>
โ Correct:
<dl>
<dt>CPU</dt>
<dd>Central Processing Unit</dd>
</dl>
โ Wrong:
<dd>Some description</dd>
โ๏ธ <dt> vs <dd>
| Tag | Meaning |
|---|---|
<dt> |
Term / title |
<dd> |
Description / explanation |
๐จ Styling Example
<dl>
<dt>HTML</dt>
<dd style="color:gray;">Structure of web pages</dd>
</dl>
๐ซ Common Mistakes
- Using
<dd>outside<dl>โ - Forgetting matching
<dt>โ - Using it like
<li>โ
๐งช Mini Exercise
Create a glossary page with:
- 5 terms using
<dt> - Descriptions using
<dd> - Style descriptions in a lighter color
- Add spacing between items