Unordered Lists

Like a laundry or shopping list, an unordered list is a collection of related items that have no special order or sequence. The most common unordered list you’ll find on the Web is a collection of hyperlinks to other documents. Some common topic, such as “Related Kumquat Lovers’ Sites,” allies the items in an unordered list, but they have no order among themselves.

The <ul> Tag

The <ul> tag signals to the browser that the following content, between it and the </ul> end tag, is an unordered list of items. Inside, a leading <li> tag identifies each item in the unordered list. Otherwise, nearly anything HTML/XHTML-wise goes, including other lists, text, and multimedia elements.

Typically, the browser adds a leading bullet character and formats each unordered list item on a new line, indented somewhat from the left margin of the document. The actual rendering of unordered lists, although similar for the popular browsers (see Figure 7-1), is not dictated by the standards, so you shouldn’t get bent out of shape trying to attain exact positioning of the elements.

Here is an example XHTML unordered list, as shown in Figure 7-1:

Popular Kumquat recipes: <ul> <li>Pickled Kumquats</li> <li>'Quats ...

Get HTML & XHTML: The Definitive Guide, 6th Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.