![]() ![]() Definition Lists ![]() | ||||
![]() |
<dl> opens a definition list <dt> precedes each defined term <dd> precedes each definition </dl> closes the definition list The definition list delivers all that it promises and more. For those who actually need to define some terms, it creates a readable list with staggered margins. And those who want the margins - but don't really need a list - can easily co-opt the tag f or their own purposes. All definition lists begin with the <dl> tag, and end with </dl>. But unlike their numbered and unnumbered cousins - which use the <li> tag to set off list items - the definition list is punctuated with the <dt> and <dd> tags, which differentiate between the terms (<dt>) and their definitions (<dd>) The HTML for a simple list would go something like this: <dl> And would look like this:
So that's why it's called a definition list. But, in truth, the <dl> tag is only rarely used for its intended purpose. More often, you'll spot it indenting text, staggering paragraphs, and generally pushing text around. Take this example:
Which displays like this:
Note that several <dl>s were combined - pushing text farther to the right, and pulling it back in. And line breaks - indicated by the <br> tag - help space out the text. Just remember to finish what you start: Every <dl> must be closed with a corresponding </dl>. Got a handle on it? Do it. | |||
Previously in HTML ...
Copyright © 1996 HotWired, Inc. All rights reserved. |