Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I put anything inside DL/DT/DDs?

Tags:

can I use definition lists just like unordered/ordered lists?

I mean insert DIVs any anything I want inside DT or DD?

<dl>   <dt>     ...   </dt>   <dd>     ...   </dd> </dl> 

Do any browsers, or search engines complain?

like image 416
Alex Avatar asked Jun 17 '11 22:06

Alex


People also ask

What is the use of DL DT and DD tags?

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.

How do you style DT and DD so on the same line?

This can be accomplished by adding a DIV element with the CSS overflow: hidden; around the content of the DD tag. You can omit this extra DIV , but the content of the DD tag will wrap under the floated DT .

What is the difference between DL and DT?

The <dl> tag is used to specify (start) the definition list. This tag is commonly used to implement a glossary. You can put only <dt> and <dd> tags inside the <dl> tag. The <dt> tag is used to specify the definition terms or items in a definition list.

Does a DL need a DT?

Definition list items ( dt and/or dd ) must be wrapped in parent dl elements to be valid. This enables screen reader users to understand the proper hierarchy of information in the list.


2 Answers

Updated answer based on comments:

This was originally answered in 2011 for HTML 4, but the answer is different for HTML5:

dt Flow content, but with no header, footer, sectioning content, or heading content descendants. dd Flow content.

  • dt element reference on W3C
  • dd element reference on W3C

Original answer:

DT elements should contain inline content.
DD elements should contain block-level content.

Definition lists vary only slightly from other types of lists in that list items consist of two parts: a term and a description. The term is given by the DT element and is restricted to inline content. The description is given with a DD element that contains block-level content.

Source: W3C

This question is also an interesting read: Why use definition lists (DL,DD,DT) tags for HTML forms instead of tables?

like image 128
Town Avatar answered Oct 12 '22 22:10

Town


Inside a DL you can only put DT and DD tags. A DT tag is an inline tag, so you should not put block elements in it. A DD tag can contain basically anything you want, it's a flow content tag.

like image 26
Arjan Avatar answered Oct 12 '22 22:10

Arjan