|
|||||||||
|
List elementsThere are a number of HTML elements for defining different types of list within the document body:
Lists may be nested and different types of list may be nested within each other. Unordered lists are displayed as lists of bullet items. Individual items within a list can be quite large - up to several paragraphs, and may contain elements such as images, hypertext links or other lists. Each list item is identified by an LI element. The </LI> end tag is optional and in fact some browsers do not recognize it. For example, the HTML
Plant Classification: <UL> <LI> annuals <LI> biennials <LI> perennials </UL>
would appear as:
Plant Classification:
Ordered lists are displayed as lists of numbered items. Each list item is identified by an LI element, as with unordered lists. The items are numbered automatically by the browser and the lists can be nested. Exactly how nested numbered lists are displayed is determined by the browser. For example the HTML:
The Seasons: <OL> <LI> Spring <LI> Summer <LI> Autumn <LI> Winter </OL>
would be displayed as:
The Seasons:
Both menu lists and directory lists are variants of unordered lists, and are intended for lists of short items that can be displayed in a compact style. The items on a menu list are frequently set up as hypertext links to create the functionality of a menu. Each menu list item should be a single line and a directory list item should not be longer than 20 characters. Some browsers display menu or directory lists in the same way as unordered lists, while others display them without the bullets that are characteristic of unordered lists.
<H1>Table of Contents</H1> Definition lists are intended for lists of terms and their definitions. The term is preceded by a <DT> tag and the definition by a <DD> tag. It is permissible to have a number of terms preceding one definition. Definition lists are often used for glossaries, for example. The following example illustrates the use of description lists:
<TITLE>Parts of a plant</TITLE> <H2>Parts of a plant</H2> This would be displayed as: Parts of a plant
The COMPACT attribute can be specified in the <DL> tag to suggest that the browser should display the definition list in a compact form, minimizing the amount of space between successive pairs of items. It may also reduce the width of the term (DT) column.
<TITLE>Trees and Shrubs</TITLE> <H2>Trees and Shrubs</H2> This would be displayed as: Trees and Shrubs
Definition lists can be used to create fancy bullet lists using an icon in each DT element, as shown in Figures and . Purists consider this to be a misuse of the construct, but currently there is no other way to achieve this effect within HTML.
Next: Highlighting Up: The document body Previous: Special characters
Spinning the Web by Andrew Ford |
||||||
Copyright © 1996-2002 Ford & Mason Ltd |