Tables vs. Definition Lists

Last updated: 2005/12/02

Return to the main page

In a question posted to webdesing-l, Maximillian Schwanekamp wondered this: when presenting a set of related key-value attributes, what would be more appropriate from a semantic point of view: a table, a definition list or something else?

In the case of Maximillian, the data he want to present was a kind of information cards for books. The implementation using definition lists would be something like this (see the source code for details):

First Item
Date Created:
5/1/2004 6:45:15 PM
Publish Status:
Not yet published
Comments:
None yet
Second Item
Date Created:
5/22/2004 8:12:55 PM
Publish Status:
Published on 5/27/2004
Comments:
5 Comments - Latest Comment by Jane Doe on 5/27/2004

Of course, a similar result can be accomplished using a table for each item. But the question here is what is more appropriate. Well, I think that book cards fit quite well in the cases of use of definition lists. At this point some people could claim that book cards aren't definitions, but the W3C specification allows more uses for dl than for definitions: "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".

As you probably read and heard a lot of times, tables should be used only for tabular data. For example, if I want to publish in a web page the staff of some business, I could use a table like this:

Position Name
CEO John T. Ripper
CIO Walter Skinner
CTO Angus MacGyver
Janitor Willy

In this table there are two groups of data (positions and names), and that data has relationships both in horizontal and in vertical directions: As position-name pairs (horizontal) and as lists of positions and names (vertical). You can also construct this using definition lists, maintaining the position-name relationship but losing the list relationship.

But in the case of the book cards the data doesn't have a clear vertical relationship: I can't think of titles for describing the list of elements of two columns apart from "keys" and "values" or similar generic names.

To make clear the difference, if we took apart the second column in the staff example we get:

Name
John T. Ripper
Walter Skinner
Angus MacGyver
Willy

which is clearly a list of names, even if we remove the column title. But in case of the book cards we'd get:

Values
5/1/2004 6:45:15 PM
Not yet published
Not yet

which at first sight doesn't have too many sense without the related keys.

So from a semantic (and quite strict) point of view, definition lists should be used for data that have a key-value relationship, while the tables would be more suitable for data in which the keys and values also have meaning as a list.

Return to the main page