<dl> <dd> and <dt> tags and their usage

T

Tim W

I was wanting to copy the text of a poem into my blog from Wikipedia here:
http://en.wikipedia.org/wiki/Calon_Lân#Lyrics
What with it being Welsh and with the indents and line breaks I just
opened the html source of the page and copied the tags and all and
pasted it in. It displays fine no probs but I was troubled by the tags I
had never come across. www.w3schools.com is very unclear on what these
tags are for, (both <dt> and <dd> seem to be the same thing, items in a
list) giving a strange example about coffees, so two questions:

I presume using these tags to format verse is just wrong and liable to
give unpredictable results?

What is the intended use of these three tags? Is there a better
explanation and examples somewhere?

Thanks,

Tim w
 
J

Jukka K. Korpela

I was wanting to copy the text of a poem into my blog from Wikipedia here:
http://en.wikipedia.org/wiki/Calon_Lân#Lyrics
What with it being Welsh

It is not properly written Welsh: it uses the ASCII apostrophe, instead
of the proper, curly punctuation apostrophe (which can be written as
&rsquo; in HTML if needed, or normally entered as such).
and with the indents and line breaks

Indentation might reflect the normal way of presenting the lyrics. I
wonder whether the use of italic is normal as well.
I just
opened the html source of the page and copied the tags and all and
pasted it in. It displays fine no probs but I was troubled by the tags I
had never come across.

The markup is odd inded.

That is not the worst part of its bogosity. See http://www.w3fools.com
for an explanation.
on what these
tags are for, (both <dt> and <dd> seem to be the same thing, items in a
list) giving a strange example about coffees, so two questions:

Nominally they mean "term being defined" and "definition for a term",
but in practice, they are just used for indentation, mostly in lists of
name/value pairs.
I presume using these tags to format verse is just wrong and liable to
give unpredictable results?

It is grotesquely wrong if the elements are taken in their defined
meanings, but virtually nobody does that. The results are fairly
predictable,
What is the intended use of these three tags? Is there a better
explanation and examples somewhere?

You might check the HTML 4.01 specification, but browser vendors, search
engine vendors, and other relevant parties don't take it seriously in
issues like this, so why bother?

The markup is odd, but it does the job of indenting stuff. It would be
easier to use <blockquote>, for an entire block, but why bother?
 
C

Captain Paralytic

I was wanting to copy the text of a poem into my blog from Wikipedia here:http://en.wikipedia.org/wiki/Calon_Lân#Lyrics
What with it being Welsh and with the indents and line breaks I just
opened the html source of the page and copied the tags and all and
pasted it in. It displays fine no probs but I was troubled by the tags I
had never come across.www.w3schools.comis very unclear on what these
tags are for, (both <dt> and <dd> seem to be the same thing, items in a
list) giving a strange example about coffees, so two questions:

I presume using these tags to format verse is just wrong and liable to
give unpredictable results?

What is the intended use of these three tags? Is there a better
explanation and examples somewhere?

Thanks,

Tim w

Well you only mentioned 2 tags not 3, but I assume that you meant to
include <dl>.

I'm not sure what it is about the w3schools explanation that is not
clear. A definition list is a list of terms and their definitions. Far
from being the same, the w3schools page shows that the item (or term)
to be described is defined in the dt tag and the description of that
item is in the dd tag.

We have dl = definition list, dt = definition term, dd = definition
description.

A search using the popular search engine Google for the words
definition list
(I got those words from the w3schools page), gives many otehr pages
that talk about definition lists. One of them has the summary:
"This article explains what definition lists are why they are useful,
and how use them when writing HTML documents.", which sounds like just
what you are asking.

In future you may find it quicker to use Google to search for the
subject of your query and to peruse the summaries of the pages that it
suggests.

Alternatively just keep asking here and I'm sure we will be only to
happy to type the terms into Google for you.
 
C

Captain Paralytic

I presume using these tags to format verse is just wrong and liable to
give unpredictable results?

Oh, as to this question. The use of the dl and dd tags (I can no <dt>
tags there), is certainly wrong in teh referenced context, but the
results are fairly predictable. Using something for a purpose for
which is is not intended may not be correct, but it does not follow
that the results of such use cannot be predicted.

A hammer is not supposed to be used to open a bottle, but I can fairly
well predict that if you keep hitting the bottle with a big enough
hammer, the bottle will break.
 
J

Jonathan N. Little

Tim said:
I was wanting to copy the text of a poem into my blog from Wikipedia here:
http://en.wikipedia.org/wiki/Calon_Lân#Lyrics
What with it being Welsh and with the indents and line breaks I just
opened the html source of the page and copied the tags and all and
pasted it in. It displays fine no probs but I was troubled by the tags I
had never come across. www.w3schools.com is very unclear on what these
tags are for, (both <dt> and <dd> seem to be the same thing, items in a
list) giving a strange example about coffees, so two questions:

I presume using these tags to format verse is just wrong and liable to
give unpredictable results?



Many will agree here that www.w3schools.com is not the best resource,
peppered with errors and has no association with w3.org. I would agree
that the application is wrong in wikipedia, a poem is not a definition
list. I would say is akin to using H# elements simply to make your text
larger. A far better approach is to make a "poem" class and style
appropriately there. Maybe make the "white-space: pre"

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Poem</title>

<style type="text/css">

.poem {
color: #000; background: #ddd;
margin: 1em; padding: 1em; border: 1px solid #000;
display: table-cell;
}
/* make elements in poem preserve white space formatting */
.poem * { white-space: pre; }
.poem p { margin: 0; padding: 0; }
.poem .chorus { font-style: italic; }
.poem .attibute { white-space: normal; text-align: right; }
</style>
</head>
<body>

<div class="poem">
<p>
Nid wy'n gofyn bywyd moethus,
Aur y byd na'i berlau mân:
Gofyn wyf am galon hapus,
Calon onest, calon lân.
</p>
<p>
Calon lân yn llawn daioni,
Tecach yw na'r lili dlos:
Dim ond calon lân all ganu
Canu'r dydd a chanu'r nos.
</p>
<p>
Pe dymunwn olud bydol,
Hedyn buan ganddo sydd;
Golud calon lân, rinweddol,
Yn dwyn bythol elw fydd.
</p>
<p class="chorus">
(Chorus)
</p>
<p>
Hwyr a bore fy nymuniad
Gwyd i'r nef ar adain cân
Ar i Dduw, er mwyn fy Ngheidwad,
Roddi i mi galon lân.
</p>
<p class="chorus">
(Chorus)
</p>
<div class="attibute">
&mdash; Welsh
</div>
</div>

</body>
What is the intended use of these three tags? Is there a better
explanation and examples somewhere?

Look at the info source and they have examples:

<http://www.w3.org/TR/html401/struct/lists.html#edef-DL>
 
T

Tim W

It is not properly written Welsh: it uses the ASCII apostrophe,
instead of the proper, curly punctuation apostrophe (which can be
written as &rsquo; in HTML if needed, or normally entered as such).


Indentation might reflect the normal way of presenting the lyrics. I
wonder whether the use of italic is normal as well.


The markup is odd inded.


That is not the worst part of its bogosity. See http://www.w3fools.com
for an explanation.


Nominally they mean "term being defined" and "definition for a term",
but in practice, they are just used for indentation, mostly in lists
of name/value pairs.


It is grotesquely wrong if the elements are taken in their defined
meanings, but virtually nobody does that. The results are fairly
predictable,


You might check the HTML 4.01 specification, but browser vendors,
search engine vendors, and other relevant parties don't take it
seriously in issues like this, so why bother?

The markup is odd, but it does the job of indenting stuff. It would be
easier to use <blockquote>, for an entire block, but why bother?

Thanks, I suspected as much.

So am I right to think that the default browser behaviour in the absence
of anything in the CSS would be just to indent? I can see that would be
a pretty useful tag. How would I know what a browser is going to do with
a tag?

Tim W
 
T

Tim W

Well you only mentioned 2 tags not 3, but I assume that you meant to
include<dl>.

I'm not sure what it is about the w3schools explanation that is not
clear. A definition list is a list of terms and their definitions. Far
from being the same, the w3schools page shows that the item (or term)
to be described is defined in the dt tag and the description of that
item is in the dd tag.

We have dl = definition list, dt = definition term, dd = definition
description.

A search using the popular search engine Google for the words
definition list
(I got those words from the w3schools page), gives many otehr pages
that talk about definition lists. One of them has the summary:
"This article explains what definition lists are why they are useful,
and how use them when writing HTML documents.", which sounds like just
what you are asking.

In future you may find it quicker to use Google to search for the
subject of your query and to peruse the summaries of the pages that it
suggests.

Alternatively just keep asking here and I'm sure we will be only to
happy to type the terms into Google for you.

Fwiw I was looking at http://www.w3schools.com/tags/tag_dd.asp where
under Definition and Usage we have:

The <dd> tag is used to describe an item in a definition list..... and
<dt> (defines the item in the list).

English is my first language and it isn't clear. Not helped by the example:

Coffee
- black hot drink
Milk
- white cold drink

In which it is anybody's guess where the list is, what is being defined,
what is being described, and what the items are.


Thanks for your help. It does help to ask people rather than googling. I
know you wouldn't reply if you didn't want to.

Tim W
 
D

Denis McMahon

Well you only mentioned 2 tags not 3, but I assume that you meant to
include <dl>.

He identified all 3 in the subject, and in the text commented that two of
three appear to act in a similar manner.

Rgds

Denis McMahon
 
D

dorayme

Tim W said:
tags ... <dt> and <dd>
....

So am I right to think that the default browser behaviour in the absence
of anything in the CSS would be just to indent?

Mostly browsers don't much do anything but style various elements a
bit and mostly they use a default style sheet for this. And mostly
they use simple styles that are not up to the standard of some
sophisticated requirements.

They are certainly not so sophisticated that, for example, there is a
button to hear the term and then the definition and the voice intones
and pauses like a teacher explaining a term. You know how teachers go!
They say a term and pause and look at the class and all the young
faces suddenly pay attention (because they need to write the thing
down or remember it for a test) and then say, slowly and carefully, -
remember, they are teaching about a possibly new term to the class -
the explanation. They know a term is being defined for them. With
browsers, fat chance! It is much more primitive in reality with
browsers. They are just insensitive robots.
I can see that would be
a pretty useful tag. How would I know what a browser is going to do with
a tag?

There is generally quite good consistency among browsers with most
elements, but it depends on how detailed you want the agreements to be.

There was an old idea once that no one seems to care about much. That
HTML had elements and that they had a meaning and were useful for more
than mere style. But I won't bother you with all that stuff.
 
C

Captain Paralytic

Thanks, I suspected as much.

So am I right to think that the default browser behaviour in the absence
of anything in the CSS would be just to indent? I can see that would be
a pretty useful tag. How would I know what a browser is going to do with
a tag?

Tim W

Actually, the big problem is that people tend to think of HTML tags in
terms of formatting, rather than in terms of labelling types of data.
It helps to understand the history. Many moons ago, before the advent
of Personal Computers and WYSIWYG editors, the way one created a
manual was to write it on a mainframe in a plain text file using a
language called GML (General Markup Language) and later BookMaster (at
least in the IBM world). The marked up file would then be fed into a
Script processor (a compiler for text) which would produce a book
formatted based on how the data was marked up. Tags in GML tended to
look like this:
:h1.Chapter 1: Introduction
:p.GML supported hierarchical containers, such as
:eek:l
:li.Ordered lists (like this one),
:li.Unordered lists, and
:li.Definition lists
:eol.
There were other tags for citations and other types of element. You
can see this concept carried across in M$ Word, where there are lots
of Styles (Heading 1, Quote, List).

The object was never to worry about the look of a style, but simply to
ensure that your markup identified the type of data correctly. The
equivalent of CSS used by the script processor would then format
everything based on its data type. You never knew what a book was
going to look like until you had compiled and printed it. M$ Word
documents written using styles rather than individual text formatting
are far easier to manage.
 
B

Beauregard T. Shagnasty

Alan_Smith said:
Many of the times, these tags are used in place of table tags.

Not in the real world...

Have you fixed the errors on your web site yet?
 

Members online

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top