Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the <dl> tag for?

Tags:

html

list

tags

Is there any logical reason for using the <dl>, <dt> and <dd> tags instead of nested, CSS-styled <ul> and <ol> tags? Or are they just an outdated group of tags waiting to be deprecated?

like image 305
Variax Avatar asked Sep 21 '12 09:09

Variax


People also ask

What is the DL tag for?

The <dl> tag defines a description list. The <dl> tag is used in conjunction with <dt> (defines terms/names) and <dd> (describes each term/name).

What is the difference between DD and DL tag?

Definition and Usage The <dd> tag is used to describe a term/name in a description list. The <dd> tag is used in conjunction with <dl> (defines a description list) and <dt> (defines terms/names). Inside a <dd> tag you can put paragraphs, line breaks, images, links, lists, etc.

What is the expansion of DL tag?

The <dl> tag in HTML is used to represent the description list. This tag is used with <dt> and <dd> tag.

Is DL a container tag?

So the <dl> tag is basically a container tag, which has content enclosed in the <dt> and <dd> tags. Also, this is a block-level element.


2 Answers

Citing the W3C spec:

The dl element represents an association list consisting of zero or more name-value groups (a description list). Each group must consist of one or more names (dt elements) followed by one or more values (dd elements). Within a single dl element, there should not be more than one dt element for each name.

So the main reason for the <dl>, <dt> and <dd> tags are to preserve the semantic connection for those name-value pairs, which would get lost, if you just used nested lists.

If you use nested lists, this could be done for various reasons (currently, e.g., many menus are structured into nested lists) and crawlers or any other system, that respects semantic annotations, would not be able to tell the difference.

If you use the above tags, however, a system can see the connection and act accordingly. So a future use maybe to extract all definitions of terms inside a larger document to create some kind of glossary.

like image 159
Sirko Avatar answered Sep 30 '22 14:09

Sirko


DL
A definition list is the container element for DT and DD elements. The DL element should be used when you want incorporate a definition of a term in your document, it is often used in glossaries to define many terms, it is also used in “normal” documents when the author wishes to explain a term in a more detail (Like this definition).

DT
The term currently being defined in the definition list. This element contains inline data.

DD
The definition description element contains data that describes a definition term. This data may be either inline, or it may be block level.

like image 26
SameSung Vs Iphone Avatar answered Sep 30 '22 14:09

SameSung Vs Iphone