Definition list

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View


I need to display a list of information of a user. Something like:

Name: John
City: London
Curriculum Vitae: Something

Should I use a definition list of this?
Or is better to have just:

  Curriculum Vitae:<br/>

Or maybe a ul list?

Which one would you advice?


Re: Definition list

On 1/14/2010 5:17 PM, shapper wrote:
Quoted text here. Click to load it

I certainly would not put a break as you show between Name and John,
City and London, etc.

Actually, this might be best done with a table.  The header row would
have Name, City, Curriculum Vitae, etc at the top of columns.  Each
following row would then have the data for one individual.


David E. Ross
< .

Don't ask "Why is there road rage?"  Instead, ask
"Why NOT Road Rage?" or "Why Is There No Such
Thing as Fast Enough?"

Re: Definition list

In article

Quoted text here. Click to load it

Why would you put so many breaks in? How is this really a paragraph

Name: John<br/>
City: London<br/>
Curriculum Vitae:<br/>
Something <br/>

is better because it is not positively fuzzing up the notion of a
paragraph element.

Better still, for semantics, is a simple table (on this no borders is

Quoted text here. Click to load it
Such use can empty the meaning of the idea of UL. It would not
technically be wrong. It would be a list of personal detail couples, the
name of the kind of detail dancing to the left of the actual detail.


Re: Definition list

Quoted text here. Click to load it

Don't (ever!) use <br> like this.

<br> means a line break within some text. It isn't a separator between
items. Because of the way SGML is fundamentally designed, it "doesn't
do separators", instead it uses "containers around items". Even though
many people use <p> as if it were a paragraph separator (it isn't),
it's actually the starting portion of the <p>...</p> paragraph
containing element - SGML just lets you be lazy (sorry, "carefully
optimized") in your markup and omit the closing tag.

Why does this matter? Well, because using separators like this means
your using "mixed content model" which is workable in SGML & HTML
(i.e. it is legal and supported), but it's a regular nightmare to make
use of for smarter applications in the future. There is no way that
some hypothetical web agent can access this page and extract the value
"London" in a straightforward manner.

But, I hear you cry, "I'm not going to write a web agent". Firstly you
probably aren't, but you might. Secondly you don't know this, and when
you find out that you are, it's always going to be last thing on a
Friday and you need it yesterday. Thirdly, you personally aren't going
to write it, but someone else is. This someone may chose to buy your
web app (or not) on such features as ease of integration like this.

Most importantly though, you are going to need this feature: because
you are very likely to want an easy CSS selector that can distinguish
between "City" and "London", because the early design brief is going
to want to style the labels & content differently  (and this is easier
than embedding <b> or <i>!)

Quoted text here. Click to load it

Definition list isn't ideal, but it's what I'd use. Remember though
the content model of <dl>, from the DTD

<dl> is a container for a list of <dt> and <dd> elements, whose order
is undefined and certainly doesn't "bind" particular <dt> and <dd>
together, other than very loosely by their sequence in the list (which
is back to mixed content model).  Despite popular misunderstanding,
there's no requirement that they appear in a rigid sequence of
<dt...><dd...>, <dt...><dd...>  (first example in the spec) but rather
it's a list of whatever order the author throws in there.

That said though, it's a list container that supports two distinct
element types, without having to put a class on everything. So it
works for this. CSS float (or if you prefer, display: inline) can do
the rest.

Site Timeline