W3C home > Mailing lists > Public > www-html@w3.org > March 2003

Re: Key/Item data

From: Jim Dabell <jim-www-html@jimdabell.com>
Date: Tue, 11 Mar 2003 16:38:16 +0000
To: www-html@w3.org
Message-Id: <200303111638.16441.jim-www-html@jimdabell.com>

On Monday 10 March 2003 10:25 pm, Graph Dept. wrote:
> I was wondering what is the general consensus for display Key/Item pairs
> (or "name/value") in (X)HTML?
> e.g.
> Name: T. Daniel
> Occupation: Web Developer
> Favorite Ice Cream: chocolate
> I've heard some say this is a good use for tables, some say that <dl> is
> better for something like this. I could argue either way, I just wanted to
> gather some more opinions.

I would say that a <dl> element would not be appropriate for this data, since 
it doesn't appear to be a list of definitions.  For instance, I'd consider 
this to be a suitable use of <dl>:

	<dd>A label identifying a particular entity.</dd>

The definition of "name" is not "T. Daniel", nor is the opposite true.  I 
would possibly mark up the example you gave as follows:

	<caption>Personal Information</caption>
		<th scope="row">Name</th>
		<td>T. Daniel</td>
		<th scope="row">Occupation</th>
		<td>Web Developer</td>
		<th scope="row">Favourite Icecream</th>

The definition of the <dl> element seems to agree with me:


...until this bit:

"Another application of DL, for example, is for marking up dialogues, with 
each DT naming a speaker, and each DD containing his or her words."

...which seems completely wrong to me, and at odds with both the name of the 
element, and its description up until that point.  A lot of people seem to 
like treating <dl> as a generic key/value container, and this example would 
seem to support that use.

So, to address your original question, I believe that, although the 
recommendation seems to condone using <dl> in this way, I would use a <table> 
element.  I may be in a minority though.

Jim Dabell
Received on Tuesday, 11 March 2003 11:41:44 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:06:03 UTC