Lists in XHTML

Three types of list are available to us when writing an XHTML document. These are:

Ordered List

An ordered list allows you to create a list of items, each of which is preceeded by a number. The list is automatically numbered in ascending order.

The list is started with a nl tag, which indicates the start of a numbered list. The nl element is the containing element, for the numbered list. Each list item is then placed inside a li element.

Unordered List

An unordered list is a fancy name for a list of bullet points that are not preceeded by numbers. The containing element for the items in an unordered list is the ul element. Again each item in the list is put inside the li element.

Definition List

The least common type of list is a definition list, which tends to comprise of words and their definitions.

The containing element for a definition list is dl element. Each term that has to be defined is contained inside a <DT> element, while the definition is contained in a <DL> element, like so.

Back to top