By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,117 Members | 2,142 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,117 IT Pros & Developers. It's quick & easy.

Definition lists as question/answer lists

P: n/a
Hello,

I have a query regarding definition lists. Is it good practice
semantically to use the dt and dd elements to mark up questions and
answers in a frequently asked questions list, or FAQ?

Here is an example of just such a usage:

<dl class="faq">
<di>
<dt>What is Ogg Vorbis?</dt>
<dd><p>Ogg Vorbis is a digital audio compression format,
roughly comparable to AAC, MP3, VQF, etc. A key
difference to these formats is that Ogg Vorbis is
intended to be patent-free.</p>
<p>Strictly speaking Ogg is the container format, and
Vorbis is the actual audio compression scheme.</p>
</dd>
</di>
<di>
<dt>Is Ogg Vorbis streamable?</dt>
<dd><p>Absolutely.</p></dd>
</di>
</dl>

(In the above example I've chosen to group the dt and dd elements with
the di element, introduced in the sixth public Working Draft of XHTML
2.0.)

According to the official Recommendations (HTML 4.0 onwards),
"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 can a question be considered a "term", and an answer be considered a
"description"? Definition lists appear to be flexible in their intended
use; for example, the HTML 4.0 Specification (December 1997) states,
"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." So is my FAQ example acceptable, or is it stretching things too
far?

(Looking to how FAQs are marked up in practice on the WWW, I
occasionally see dl being used; far more often, though, heading and
paragraph tags are used instead.)

Many thanks,

Dave
Jul 20 '05 #1
Share this Question
Share on Google+
9 Replies


P: n/a
In article <sl****************@armaros.dmh.org.uk>,
Dave H <dm*@armaros.dmh.org.uk> wrote:
I have a query regarding definition lists. Is it good practice
semantically to use the dt and dd elements to mark up questions and
answers in a frequently asked questions list, or FAQ?


Why not an unordered list with heading and paragraph markup inside? you
could even wrap the heading into a blockquote, since a FAQ is assumed to
be questions from outsiders.

--
Kris
<kr*******@xs4all.netherlands> (nl)
Jul 20 '05 #2

P: n/a
Kris <kr*******@xs4all.netherlands> wrote:
Why not an unordered list with heading and paragraph markup inside?
There are practical reasons against using list markup in such cases.
After all, we don't use unordered list markup for simple documents that
contain headings and paragraphs, although we _could_ regard it as a
structure consisting of a sequence of items. Lists were clearly meant to
be used what we intuitively regard as an itemized list. And the default
list presentation (with bullets) would probably be something you want to
get rid of.

So just headings and paragraphs is fine. Naturally with other ingredients
like tables and lists if suitable for presenting an answer.
you could even wrap the heading into a blockquote, since a FAQ is
assumed to be questions from outsiders.


A FAQ is assumed to be a list of frequently asked questions with answers
(though quite often companies present "FAQ lists" that contain answers to
questions that they'd like to see asked), but this does not mean that the
questions need to be quoted verbatim. After all, if the question is
frequently asked, it has been asked in many different formulations and
wordings, and the composer of a FAQ should normally formulate the
questions in a concise, understandable way - and abstractly in the sense
of not including specific details pertaining to an individual question.

This means that almost always, the formulations of the questions have
been composed, or at least edited, instead of quoting directly someone's
question. And <blockquote> means a direct quotation, not a rephrase.

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html

Jul 20 '05 #3

P: n/a
On Sat, 31 Jul 2004 09:49:35 -0500, Dave H <dm*@armaros.dmh.org.uk> wrote:
Hello,

I have a query regarding definition lists. Is it good practice
semantically to use the dt and dd elements to mark up questions and
answers in a frequently asked questions list, or FAQ?

[... snip example]

According to the official Recommendations (HTML 4.0 onwards),
"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 can a question be considered a "term", and an answer be considered a
"description"? Definition lists appear to be flexible in their intended
use; for example, the HTML 4.0 Specification (December 1997) states,
"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." So is my FAQ example acceptable, or is it stretching things too
far?


I would find it acceptable. It would be similar to the structures which
they show in the spec, in that multiple questions could have a common
answer, in the way that they show multiple terms having a common
definition, and there could be multiple answers to a common question (if
opinions vary), just as there are multiple definitions to a single term.

I would structure a FAQ in that manner, anyway, unless I had some other
reason not to do so. After all, definition lists were not made just for
dictionaries.

--
Accessible web designs go easily unnoticed;
the others are remembered and avoided forever.
Jul 20 '05 #4

P: n/a
On Sat, 31 Jul 2004 09:49:35 -0500, Dave H <dm*@armaros.dmh.org.uk>
wrote:
I have a query regarding definition lists. Is it good practice
semantically to use the dt and dd elements to mark up questions


No one can agree. Certainly not Jukka and I a couple of weeks ago (I
suggest you Google the thread). Subject is "Problem with descriptive
lists in CSS"

--
Smert' spamionam
Jul 20 '05 #5

P: n/a
On Wed, 04 Aug 2004 22:20:37 +0100, Andy Dingley
<di*****@codesmiths.com> wrote:
On Sat, 31 Jul 2004 09:49:35 -0500, Dave H <dm*@armaros.dmh.org.uk>
wrote:
I have a query regarding definition lists. Is it good practice
semantically to use the dt and dd elements to mark up questions


No one can agree. Certainly not Jukka and I a couple of weeks ago (I
suggest you Google the thread). Subject is "Problem with descriptive
lists in CSS"


It's much more useful to give the message-id, since that'll point at
the unique thread you're talking about for a long time to come, while
that subject will probably end up pointing at additional threads in
the future:

16**************************@posting.google.com

Google lets you search by Message-ID on the "Advanced Search" page.

All the best,
-Claire
Jul 20 '05 #6

P: n/a
Andy Dingley <di*****@codesmiths.com> wrote:

No one can agree. Certainly not Jukka and I a couple of weeks ago (I
suggest you Google the thread). Subject is "Problem with descriptive
lists in CSS"


So it seems to come down to matter of opinion, then! Thank you to
everyone who commented in this thread.

Incidently, anyone concerned that the definitions of some of the HTML
elements are too vague might be interested in reading the present XHTML
2.0 draft <http://www.w3.org/TR/xhtml2/> and commenting on the
www-html-editor electronic mailing list.

Regards,

Dave
Jul 20 '05 #7

P: n/a
> On Sat, 31 Jul 2004 09:49:35 -0500, Dave H <dm*@armaros.dmh.org.uk>
wrote:
According to the official Recommendations (HTML 4.0 onwards),
"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 can a question be considered a "term", and an answer be considered
a "description"? Definition lists appear to be flexible in their
intended use; for example, the HTML 4.0 Specification (December 1997)
states,
Since they show an example in which a DL is not being used for definitions,
it seems that they intend definition list markup to more structural than
semantic. That is, the markup indicates, "This information is organizable
in the following manner," rather than saying "This is a definition list" --
it provides structure for the information, it doesn't describe what the
information _is_. Obviously, the W3C has done a poor job of naming its
elements.

The use for a definition list is not merely one in which each DD and DT is
necessarily matched up one-to-one (although that often ends up being the
case), but rather, one where each DT _can_ have multiple DDs, where
multiple DTs can have one DD, and multiple DTs can share the same set of
multiple DDs. The spec shows an example of the latter case, which I have
modified to include closing </DT> and </DD> tags:

<DL>
<DT>Center</DT>
<DT>Centre</DT>
<DD> A point equidistant from all points
on the surface of a sphere.</DD>
<DD> In some field sports, the player who
holds the middle position on the field, court,
or forward line.</DD>
</DL>

The most obvious use for such a structure happens to be definitions.

What is interesting is how they define a definition list:
"Definition lists vary only slightly from other types of lists in
that list items consist of two parts: a term and a description."
They choose an interesting choice of words: "a term and a description."
That's not "a word and a definition" or "a term and a definition." So what
exactly _is_ a "term" and a "description"? The semantic meanings are not
explicitly defined. Nor are they vaguely defined, and only the following
information is given:
"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."

The only reference to "definitions" in defining the purpose of a definition
list is in the name "definition list" itself! And we know that an
element's name is not necessarily a precise indication of its purpose --
just look at ADDRESS.

(Except look what the DTD has to say:
"<!-- definition lists - DT for term, DD for its definition -->"

There they say in the comment that DD is for the term's definition.
"<!ELEMENT DL - - (DT|DD)+ -- definition list -->
<!ELEMENT DT - O (%inline;)* -- definition term -->
<!ELEMENT DD - O (%flow;)* -- definition description -->"

Here they say in the comment that DD is for the "definition description."
I take that to mean "definition list term" and "definition list
description" -- they are just telling what DT and DD are initials for. It
seems to me that is what was meant. Not that the comments in the DTD are
that important.)

"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."
Considering the alternate example given, of dialogue, I conclude that
definition list markup is not strictly for definition lists.

HOWEVER:

The fact (or my opinion) that definition list markup is not designated
strictly for definition lists does not mean that a definition list is the
best way to go. For instance, their dialogue example is a terrible one. I
would markup dialogue as a table, in which the first column has speakers,
the second column has what they say, and the third column (if there is a
third column) having comments on how the second should be said (such as
"(angrily)"). Thus, each row represents a single statement.

It would seem to me that most of the uses of definition lists are for
content that could/should (debatably) be marked up with tables, except that
the author wants it to be displayed stylistically in the manner in which
definition lists are usually displayed.

I woudl group the uses of definition lists into two types: The kind that
can be expressed with tables, and the kind where one-to-many or many-to-
many relationships occur of definitions and terms. However, with rowspan
attributes, even the one-to-many relationships of DTs and DDs can be
expressed as tables. So the two types would be data that is tabular and
data that can have many-to-many relationships.

So does that mean that definition lists' only exclusive structural use
(that cannot be represented by tables) is for the availability of many-to-
many relationships bewteen DDs and DTs (as shown in the center/centre
example) (alongside with many-to-one and one-to-one relationships as well)?
If you can find such a use of definition lists on the web that isn't a
dictionary, I'll give you a cookie. In fact, if you find even an online
dictionary that uses a many-to-many relationship with definition lists, you
get a cookie then. One imagined use, though, would be having multiple FAQ
deserving of exactly the same answer -- except that differing opinions
exist, so multiple answers are given.

Since such uses of definition lists are quite rare, it seems to me that
definition lists were _really_ added to the spec for one of two reasons:

1. A presentationally different method of displaying tabular data.
2A. Exclusive use as a means of providing _definitions_ for words, like a
dictionary.
2B. Use as a means of providing _descriptions_ for words/things.

There are many sorts of data that could be expressed tabularly, but are not
represented in that format. I am going to the extreme, but even a list of
heading-section pairs can be represented in a table, when the headings are
of the same level of importance. Likewise, FAQuestions and answers are
tabular in nature (even _moreso_ than heading-section pairs, because
heading-section pairs are merely a small piece of a _tree-like_ structure.)

That does not mean they would be represented as such. After all, HTML does
not have any explicit mechanisms for indicating tree-like heading
structure, although DIV could be used informally for that purpose: it just
has disconnected headings and paragraphs/lists/etc (or, headings and non-
headings).

As far as dictionaries go: Most dictionaries do not put two words together
to be defined at once, though -- they have them in alphabetical order, with
the "definition" for one word being the other, with maybe a note about its
use being "cheifly British" etc. Thus, there is no reason that even
_dictionaries_ could not be represented tabularly.

The thing is, reading definitions tabularly is awkward. It is easier to
read them in definition list format. Therefore, I consider definition
lists to be another way to express tabular data. And since definition
lists consist of terms and _descriptions_, I do not think that they are to
be strictly used as dictionaries. However, I do think that the DD should
describe the term, or describe something about the term.

So definition lists' presence in HTML is for presentational purposes. If
they weren't presentational, DD and DT would be grouped together with TH
and TD - as table cell elements.

So, I finally conclude that a definition list is a linearization of a two-
column table. Somewhat like sectioned and subsectioned documents
themselves are linearizations of the documents' (sub)sections' tree-like
structure.
So is my FAQ example acceptable, or is it stretching
things too far?

Do you consider your FAQ example to be tabular data? Is it tabular data in
the form of "a term and a _description_."

Another way to linearize FAQ-like tabular data is to use headings and
paragraphs, which is what I would use.

Here is the W3C's Definition List section in the spec:
<http://www.w3.org/TR/html401/struct/lists.html#edef-DL>

Sam Hughes (me) wrote:
I would find it acceptable. It would be similar to the structures which
they show in the spec, in that multiple questions could have a common
answer, in the way that they show multiple terms having a common
definition, and there could be multiple answers to a common question (if
opinions vary), just as there are multiple definitions to a single term.

I would structure a FAQ in that manner, anyway, unless I had some other
reason not to do so. After all, definition lists were not made just for
dictionaries.


So I'm changing this answer. A question and answer section _could_ be
tabular, but so could equal-level headings and their accompanying text. I
would consider a FAQ question to be more like a heading than a definition
_term_. Additionally, the answer certainly does not describe the question
itself or anything about the question -- it gives the answer.

If you made a list of FAQs where the accompanying text described what the
question was REALLY asking, then a definition list would be appropriate.

--
Accessible web designs go easily unnoticed;
the others are remembered and avoided forever.
Jul 20 '05 #8

P: n/a
On Thu, 5 Aug 2004, Sam Hughes wrote:
Since they show an example in which a DL is not being used for definitions,
it seems that they intend definition list markup to more structural than
semantic.
The HTML spec indeed reveals itself to have been written by committee
;-} and this is one of the places where it shows.

Jukka is well known for taking a strict line on this one. I have to
admit to being quite a bit broader myself.
The use for a definition list is not merely one in which each DD and DT is
necessarily matched up one-to-one (although that often ends up being the
case),
It should be noted that a dt element can validly (I mean, "valid" in
terms of HTML syntax) have several dd elements; what this means
semantically is not very clearly expressed.
but rather, one where each DT _can_ have multiple DDs, where
multiple DTs can have one DD, and multiple DTs can share the same set of
multiple DDs. The spec shows an example of the latter case, which I have
modified to include closing </DT> and </DD> tags:
quite so.
(Except look what the DTD has to say:
"<!-- definition lists - DT for term, DD for its definition -->"
But the comments in the DTD are -not- normative. I can show you other
places where there are inappropriate comments in the DTD.

So they might help us to understand what the drafters had in mind at
the time, but they don't constitute an authoritative definition of
HTML semantics.
The fact (or my opinion) that definition list markup is not designated
strictly for definition lists does not mean that a definition list is the
best way to go. For instance, their dialogue example is a terrible one. I
would markup dialogue as a table, in which the first column has speakers,
the second column has what they say, and the third column (if there is a
third column) having comments on how the second should be said (such as
"(angrily)"). Thus, each row represents a single statement.


good point.

[snipped a lot that I didn't want to comment on...]

cheers
Jul 20 '05 #9

P: n/a
"Alan J. Flavell" <fl*****@ph.gla.ac.uk> wrote in
news:Pi******************************@ppepc56.ph.g la.ac.uk:
Sam Hughes wrote:
(Except look what the DTD has to say:
"<!-- definition lists - DT for term, DD for its definition -->"
But the comments in the DTD are -not- normative. I can show you other
places where there are inappropriate comments in the DTD.

So they might help us to understand what the drafters had in mind at
the time, but they don't constitute an authoritative definition of
HTML semantics.


Well, Sam Hughes wrote: Not that the comments in the DTD are that important.


but thanks for clarifying that.
--
Accessible web designs go easily unnoticed;
the others are remembered and avoided forever.
Jul 20 '05 #10

This discussion thread is closed

Replies have been disabled for this discussion.