Lists
Last update on: 05-14-2008There are many reasons why you might want to add a list to your pages, from putting your five favorite albums on your home page to including a numbered set of instructions for visitors to follow.
You can create three types of lists in XHTML:
- Unordered lists, which are like lists of bullet points
- Ordered lists, which use a sequence of numbers or letters instead of bullet points
- Definition lists, which allow you to specify a term and its definition
Using the <ul> Element to Create Unordered Lists
If you want to make a list of bullet points, you write the list within the <ul> element (which stands for unordered list). Each bullet point or line you want to write should then be contained between opening <li> tags and closing </li> tags (the li stands for list item).
Example:
Ordered Lists
Sometimes, you want your lists to be ordered. In an ordered list, rather than prefixing each point with a bullet point, you can use either numbers (1, 2, 3), letters (A, B, C) or Roman numerals (i, ii, iii) to prefix the list item.
Using the type Attribute to Select Numbers, Letters, or Roman Numerals:
| Value for type Attribute | Description | Examples |
| 1 | Arabic numerals (the default) | 1, 2, 3, 4, 5 |
| A | Capital letters | A, B, C, D, E |
| a | Small letters | a, b, c, d, e |
| I | Large Roman numerals | I, II, III, IV, V |
| i | Small Roman numerals | i, ii, iii, iv, v |
Definition Lists
The definition list is a special kind of list for providing terms followed by a short text definition or description for them. Definition lists are contained inside the <dl> element. The <dl> element then contains alternating <dt> and <dd> elements. The content of the <dt> element is the term you will be defining. The <dd> element contains the definition of the previous <dt> element. For example, here is a definition list that describes the different types of lists in XHTML
Basics of HTML's lessons:
Structuring Your HTMLThe Title
Headings
Paragraphs
Lists
Comments
Tags Summary

