Learning HTML 3.2 by Examples, section 5 Descriptions of HTML 3.2 tags:

UL - unnumbered list

Purpose

To present information in a list form (without numbering the items).

Typical rendering

A bulleted list. The list items are presented separately, although possibly with less space between them than there is e.g. between paragraphs. The presentation is often indented in a manner which causes nested lists to be indented according to their structure.

Basic syntax

<UL>
<LI> list item 1
<LI> list item 2
...
</UL>

Possible attributes

attribute name possible values meaning notes
TYPE DISC, SQUARE, CIRCLE default bullet style for items Not in HTML 2.0!
COMPACT COMPACT reduced interim spacing often ignored by browsers

Both attributes are deprecated in HTML 4.0.

The default value of bullet type generally depends on the level of nesting (various) lists.

Allowed context

Block container.

Contents

LI elements (one or more).

Examples

A simple example:

Example UL-1.html:

Remember to buy
<UL>
<LI> milk
<LI> bread
<LI> apples.
</UL>
A contrived example to show what the bullets may look like. Notice that TYPE attribute in a LI element overrides that of an enclosing UL element.

Example UL-2.html:

<UL TYPE=DISC COMPACT>
<LI> disc
<LI TYPE=SQUARE> square
<LI TYPE=CIRCLE> circle
</UL>
See also Examples of various list elements in HTML.

Notes

See general notes about list elements for a discussion of selecting between them.

If your list items contain numeric or alphabetic labels like 1, 2, 3, ... or a, b, c, ..., you should use an ordered list, the OL element (and remove those labels, since they are generated by a Web browser when OL is used).

A UL element must contain at least one LI element. Some people and some HTML editors may generate UL elements with just text within, possibly even nesting UL elements just in the hope of getting different amounts of indentation. If you have to resort to such tricks, enclose the text into an LI element (although this will usually cause a bullet in the display) and this in turn into UL. (Style sheets will provide mechanisms for controlling indentation.)



Date of last update: 2010-12-16.
This page belongs to the free information site IT and communication, section Web authoring and surfing, by Jukka "Yucca" Korpela.