Forum Moderators: open

Message Too Old, No Replies

Definition Lists

Can they contain other list types?

         

Hester

4:19 pm on Mar 19, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



There's a lot of talk at the moment about using lists to mark up pages. Not just the menus, but the whole page [burned.com]! Anyway, recently I've come across a site that is using code like this:

<dl>
<dt>Section 1</dt>
<dd>
<ul>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
</ul>
</dd>
</dl>

Is this right?! Or should definition lists only contain standard subelements such as <dd>? I've checked the HTML 4.01 specs, but they don't even use closing tags in their examples! (Apparently they're optional.) But this seems a strange mix of two list types to me.

ajkimoto

4:42 pm on Mar 19, 2004 (gmt 0)

10+ Year Member



Hester,

I just ran it through validator.w3.org and it reported that it is valid (even xhtml strict)

ajkimoto

pageoneresults

4:47 pm on Mar 19, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I've not seen that particular use of nesting lists before but, it is valid markup as specified by the W3C (see quote below).

<dl>
= Definition List
<dt>
= Definition Term
<dd>
= Definition

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.

References

<added>

Lists may also be nested and different list types may be used together, as in the following example, which is a definition list that contains an unordered list (the ingredients) and an ordered list (the procedure):

P.S. There is some contradictory information in that section from the W3C. In one instance they state...

Start tag: required, End tag: required

...yet in another instance they state this...

Both types of lists are made up of sequences of list items defined by the LI element (whose end tag may be omitted).

I close all of my tags.