The <dd>
tag in HTML is used to define a description or definition of a term in a description list. It is used in conjunction with the <dl>
(description list) and <dt>
(term or item) tags.
Here’s an example of how the <dd>
tag can be used:
<dl>
<dt>HTML</dt>
<dd>HyperText Markup Language is the standard markup language for creating web pages and web applications.</dd>
<dt>CSS</dt>
<dd>Cascading Style Sheets is a style sheet language used for describing the presentation of a document written in HTML or XML.</dd>
</dl>
In the example above, the <dt>
tag is used to define the terms “HTML” and “CSS”, while the <dd>
tag is used to provide a description or definition for each term. When this code is rendered in a web browser, it will display as:
HTML HyperText Markup Language is the standard markup language for creating web pages and web applications.
CSS Cascading Style Sheets is a style sheet language used for describing the presentation of a document written in HTML or XML.
Here are some additional details about the <dd>
tag in HTML:
- The
<dd>
tag should always be used within a<dl>
tag, which is used to create a description list. - Each
<dd>
tag should be paired with a corresponding<dt>
tag, which is used to define the term or item being described. - The
<dd>
tag can contain any valid HTML content, including text, images, links, and other HTML tags. - It is possible to have multiple
<dd>
tags for a single<dt>
tag, which can be useful when providing multiple definitions or descriptions for a term. - By default, the browser will display the content within the
<dd>
tag with a slight indent from the left margin, to indicate that it is a description or definition of the preceding term.
Here’s an example of how multiple <dd>
tags can be used for a single <dt>
tag:
<dl>
<dt>HTML</dt>
<dd>HyperText Markup Language is the standard markup language for creating web pages and web applications.</dd>
<dd>It is a markup language that describes the structure of content on a web page.</dd>
<dt>CSS</dt>
<dd>Cascading Style Sheets is a style sheet language used for describing the presentation of a document written in HTML or XML.</dd>
</dl>
In this example, there are two <dd>
tags for the “HTML” term, which provide two different descriptions of what HTML is.
[…] <dd> […]