views:

243

answers:

3

I had some site templates designed for me recently. I got the final HTML code, which validates, but the structure of the document is laid out using DL-DD pairs:

<dl>
  <dd class="some-class">
    Some text.
  </dd>
</dl>

I'm not especially familiar with those tags as I've never used them much, but they don't seem intended for document structure. Am I right? Why would a designer do this?

+1  A: 

From WC3: http://www.w3.org/TR/html401/struct/lists.html#h-10.3

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.

So given your example, these types of structures should be used for a specific type of content and not structuring of data that does not fit within this context.

Gavin Miller
My main question is, is there any valid reason a designer would use these tags for document strucuture, or is this just WTF code?
Ian
Ahh, I see; yes, this is a WTF piece of code.
Gavin Miller
A: 

You're right in that it shouldn't be used like that. The only reason I can think of for the designer using them is that the <dd> tag is indented in most browsers. If they're overriding the padding/margins on them, then your guess is as good as mine.

Ant P.
+3  A: 

A DL tag is about the same as a UL tag, it starts an unordered list.

The difference being that there basically is no bullet in a DL/DD couple.

Most of the time, though, it's used for it's real use, that is, a Definition List, and is used with DT and DD, which are Definition Term and Definition Description which would look like :

<DL>
  <DT>CSS</DT>
  <DD>Cascading Style Sheet</DD>
</DL>

which will, by default, indent the term a bit, and indent it's definition a bit more.

mat