Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it correct to nest HTML definition lists (<dl>)?

Is it semantically correct to nest definition lists, or should they simply be a 'flat list of name/value pairs'.

The specs don't seem to forbid it.

Further to this question.

like image 681
meleyal Avatar asked Dec 23 '08 15:12

meleyal


People also ask

Is there any description list defined by DL tag in HTML?

<dl>: The Description List element. The <dl> HTML element represents a description list. The element encloses a list of groups of terms (specified using the <dt> element) and descriptions (provided by <dd> elements).

Does HTML support nesting of lists?

The proper way to make HTML nested list is with the nested <ul> as a child of the <li> to which it belongs. The nested list should be inside of the <li> element of the list in which it is nested.

Which is the correct syntax of definition list?

Content Model: Optional list header(LH), followed by one or more terms(DT) and definitions(DD). A definition list is a list of terms and corresponding definitions. Definition lists are typically formatted with the term on the left with the definition following on the right or on the next line.

How do you define a list in HTML?

Use the <dl> tag to add definition lists. The HTML <dl> tag is used for declaring a definition list. This tag is used within <dd> tag. A definition list is similar to other lists but in a definition list, each list item contains two entries; a term and a description.


1 Answers

Well the spec seems to allow it, provided that only the <dd> contains nested lists. The spec states that a <dt> is an inline element, so it can't contain a nested list. A <dd> is a block element, so an inner list inside one of these is fine.

like image 80
Yuliy Avatar answered Oct 29 '22 16:10

Yuliy