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.
<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).
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.
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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With