ToC ~ Up ~ Prev ~ Next ~ Index Introduction to HTML
Last Update: 5 January 1998

4.7 Lists

HTML supports several elements for making lists. They can be divided into two types: glossary lists, and regular lists. Glossary Lists are denoted by the element <DL>, while regular lists are denoted by the elements <UL>, <OL>, <MENU> and <DIR>. Lists can be nested. Thus you can have a regular list within a regular list, a regular list within a glossary list, and so on. Some examples are shown below.

This document describes glossary lists. The following document ([Next] from the menu at the top of the page) explains the formatting of regular lists.

4.7.1 DL Element: Glossary Lists

This list type, also known as a definition list, is used to present a list of items along with descriptive paragraphs. This can be used for glossaries, but is also useful for presenting a named list of items and their meanings. The items within the list are introduced by the two elements:

<DT> -- The `Term' (a single line)
<DD> -- The `Definition' (may be multiple lines)

DL can take a single attribute, COMPACT, to signify that the list is small (or large) and should be rendered in a physically compact way. This attribute is ignored by several browsers.

4.7.2 Example of DL Lists

Here is an example from the Paragraphs section of this manual (with a small addition to show a nested regular list:)

<dl>
<dt> Things to Avoid: </dt>
    <dd> You should NOT use elements that define paragraph
    formatting within the PRE element. This means you should
    not use <code> &lt;P>, &lt;ADDRESS>, &lt;Hn> 
    </code>and so 
    on. You should avoid the use of tab characters -- use single 
    blank characters to space text apart. </dd>
<dt> Things That are OK: </dt>
    <dd>You <em> can </em> use Anchor.  A typed 
    carriage return will cause a new line in the presented text.
    People you should never let format lists include:
    <ul>
    <li> Bozo the Clown </li>
    <li> Uncle Fester </li>
    <li> Knights who say nii </li>
    </ul>
    Which would be downright silly in the first place. </dd>
</dl>

This is rendered as:

Things to Avoid:
You should NOT use elements that define paragraph formatting within the PRE element. This means you should not use <P>, <ADDRESS>, <Hn> and so on. You should avoid the use of tab characters -- use single blank characters to space text apart.
Things That are OK:
You can use Anchor. A typed carriage return will cause a new line in the presented text. People you should never let format lists include: Which would be downright silly in the first place.

Look at Section 4.7.2 for information on regular lists.


ToC ~ Up ~ Prev ~ Next ~ Index Introduction to HTML
© 1994-1998 by Ian Graham
Last Update: 5 January 1998