[html5] List types
Jukka K. Korpela
jukka.k.korpela at kolumbus.fi
Sat Oct 23 03:34:17 PDT 2010
Renatho Rosa wrote:
> Before the HTML5 the dl tag was a "definition list"
In practice, the dl element has been used for a wide range of purposes,
defeating the original idea. Semantic markup isn't very useful if most pages
use elements in a manner that conflicts with the defined semantics. For
example, if a search engine treated dd as enclosing a term being defined,
for the purposes of searching for definitions (or excluding defining
occurrences from results), it would not find many definitions, and it would
HTML 4 reflects this in its watered-down, pretty useless "definition" of dl,
first calling it a definition list, then saying that dd gives a
_description_ (not definition), and ending this with the messy statement
"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." (Oddly
enough, the HTML5 draft explicitly refutes such an idea, beating a dead
horse, I would say. If someone has used dl for such a purpose, why should we
tell him it's wrong?)
> Now, in the new specification,
You misspelled "current draft".
> the dl is "description list" and de
> definition is: "Name-value groups may be terms and definitions,
> topics and values, questions and answers, or any other groups of
> data.". So it's not more a discussion =)
Working drafts are discussion documents, though people might, at their own
risk, also use them in authoring and in implementing software.
In practice, the dl element has become a layout tool for certain types of
data. This can hardly be changed any more. It needs to be incorporated as a
legacy element, hopefully with no misleading statements about its being a
definition list. "Description list" is more appropriate than the old phrase
"definition list", but the word "term" is still misleading in the current
formulation of HTML5. Maybe dl could be called "variable list"; cf. to
http://oreilly.com/oreilly/author/stylesheet.html (which presents a
definition list as an example of a variable list). It would perhaps best be
characterized as a list of (typically short) items with (typically longer)
other kinds of items associated with them. Logically, it's more or less the
equivalent of a two-column table.
Markup for definitions would be something completely different. It's a very
complicated issue, much more
complicated than the new semantic elements that have been proposed in the
HTML5 draft, so it should probably wait for HTML 6, or at least HTML5.1.
> But other discussion is "ol" or "ul" for forms. What's more correct?
Since the early days, ol has been a numbered list and ul has been a bulleted
list. The difference is in rendering and could be expressed in CSS. The
logical move would be to introduce the <list> element and deprecate (using
whatever is politically correct way of deprecating things this week) <ul>
and <ol>, but this is hardly a place for being logical. It's pretty harmless
that authors select <ul> or <ol> according to the desired default rendering.
> Here a example by alistapart with use of "ol":
It's pretty nonsensical. Putting form fields into a numbered list doesn't
help anyone. A sequence of form fields with associated labels constitutes a
two-column table more than anything else. (There's little point in making it
a dl element, since the default rendering would be rather unsuitable.)
> In HTML5 spec
The current W3C draft for HTML5.
> says: "The
> represents <http://dev.w3.org/html5/spec/rendering.html#represents> a
> of items, where the items have been intentionally ordered, such that
> changing the order would change the meaning of the document."
That's just a misguided attempt at retrofitting "semantics" into an age-old
construct that simply corresponds to the idea of a numbered list. The
_dangerous_ idea is the obvious implication, explicitly written out in the
HTML5 draft, that in a ul element, the order is _not_ significant. This is
just absurd. Millions of people have created ul elements without meaning
that someone else, or maybe a browser, could arbitrarily reorder the items.
The essential difference is that in an ol element, the numbers explicitly
indicate an order. Whether the order itself is essential cannot be deduced
from the markup. The author may have chosen to use ol e.g. just because the
items will then be automatically numbered, so that they can more easily be
referred to, or maybe just to indicate the number of items in a natural way.
More information about the Help