HTML definition list - dl, dt, dd tag and elements
1. HTML definition list represents a term and a relevant description in the form of the list.
2. HTML definition list starts and ends with dl element (i.e. <dl> and </dl>).
3. The terms are enclosed with dt element.
4. The description is enclosed with the dd element.
5. Another usage of dl, dt and dd elements are to create a dialog. Where each dt specifies the name of the speaker, and each dd containing his or her words.
Syntax
<dl> <dt> <dd>text</dd> </dt> ....................................... </dl>
Category
HTML dl, dt and dd elements are part of HTML Lists.
Whether both start and end tags are required
Yes for dl element and start tag required but end tag optional for dt and dd elements.
Can contain
Element | Can contain |
---|---|
dl | One or more DT or DD elements. |
dt | Inline elements. |
dd | Inline as well as block-level elements. |
Can reside within
Element | Can reside within |
---|---|
dl | APPLET, BLOCKQUOTE, BODY, BUTTON, CENTER, DD, DEL, DIV, FIELDSET, FORM, IFRAME, INS, LI, MAP, NOFRAMES, NOSCRIPT, OBJECT, TD, TH. |
dt | DL. |
dd | DL. |
Attributes
Attributes specific to this element
None.
Identifiers
id, class. For dl, dt and dd.
language information and text direction
lang, dir. For dl, dt and dd.
Title
Title. For dl, dt and dd.
Style
Style. For dl, dt and dd.
Events
onclick, ondblclick, onmousedown, onmouseup, onmouseover, onmousemove, onmouseout, onkeypress, onkeydown, onkeyup. For dl, dt and dd.
Supported doctypes
HTML 4.01 Strict, HTML 4.01 Transitional, and HTML 4.01 Frameset.
Example of using HTML definition list
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>html definition list example</title>
</head>
<body>
<dl>
<dt>PHP</dt>
<dd>A server side scripting language.</dd>
<dt>JavaScript</dt>
<dd>A client side scripting language.</dd>
</dl>
</body>
</html>
Result
View this example in a separate browser window
Pictorial presentation
Previous: HTML li tag and element
Next: HTML dir tag and element
Test your Programming skills with w3resource's quiz.
It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.
https://w3resource.com/html/definition-lists/HTML-definition-lists-dl-dt-dd-tags-elements.php
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics