HTML <dd> Tag
The HTML <dd>
tag is used to define a description or value within a <dl>
(definition list) in an HTML document. It is typically used in conjunction with the <dt>
tag, which is used to define a term or name. The <dd>
tag is used to provide the description or value of the term defined by the <dt>
tag.
Here is an example of how the <dd>
tag is used in HTML:
<dl>
<dt>Apple</dt>
<dd>A fruit that grows on trees and is typically red or green in color.</dd>
</dl>
In the above example, the term "Apple" is defined by the <dt>
tag, and the description of the term is provided by the <dd>
tag.
Main Attributes of the <dd>
Tag
Attribute | Description |
---|---|
class |
Specifies one or more class names for the <dd> element (to be used with CSS). |
id |
Specifies a unique id for the <dd> element. |
style |
Specifies an inline CSS style for the <dd> element. |
Here is an example of using the <dd>
tag with the class
attribute:
<dl>
<dt>HTML</dt>
<dd class="description">Hypertext Markup Language</dd>
</dl>
In this example, the <dd>
element is assigned the class name "description", which can be styled using CSS.
That's all for this tutorial on the HTML <dd>
tag. Feel free to experiment with it in your own code to better understand how it works!