XHTML Tutorial: Standards-Based Web Design

by Paul Bohman

Ordered (Numbered) Lists

Ordered (numbered) lists are almost exactly the same as unordered lists. The only difference is that the list has numbers instead of bullets:

How to cook pasta:

  1. Pour water into a pot
  2. Put the pot on the stove
  3. Turn up the heat on the stove to high
  4. When water boils, reduce heat slightly
  5. Place pasta in the boiling water
  6. Cook until pasta is soft but not mushy
  7. Turn of stove
  8. Remove pot from the stove
  9. Drain water from the pot; retain the pasta
  10. Serve pasta (with sauce, spices, side dishes, etc.)

The code for the above list is as follows:

<ol>
	<li>Pour water into a pot</li>
	<li>Put the pot on the stove</li>
	<li>Turn up the heat on the stove to high</li>
	<li>When water boils, reduce heat slightly</li>
	<li>Place pasta in the boiling water</li>
	<li>Cook until pasta is soft but not mushy</li>
	<li>Turn of stove</li>
	<li>Remove pot from the stove</li>
	<li>Drain water from the pot; retain the pasta</li>
	<li>Serve pasta (with sauce, spices, side dishes, etc.)</li>
</ol>

The <ol> stands for "ordered list." As with unordered lists, the <li> stands for "list item."

Just as with unordered lists, it is possible to embed lists within ordered lists. It is even possible to embed unordered lists within ordered lists, and vice versa, as shown in the example below:

How to cook pasta:

  1. Pour water into a pot
  2. Put the pot on the stove
  3. Turn up the heat on the stove to high
  4. When water boils, reduce heat slightly
  5. Place pasta in the boiling water
  6. Cook until pasta is soft but not mushy
  7. Turn of stove
  8. Remove pot from the stove
  9. Drain water from the pot; retain the pasta
    1. Place a collander in the sink
    2. Pour all contents into the collander
    3. Let sit for a minute or so, to allow water to drain
  10. Serve pasta. Suggested accompanying foods include:
    • Tomato-based pasta sauce
    • Grated parmesan or romano cheese
    • Salad
    • Mixed squash and zucchini
    • Bread

The code for the above list is shown below:

<ol>
	<li>Pour water into a pot</li>
	<li>Put the pot on the stove</li>
	<li>Turn up the heat on the stove to high</li>
	<li>When water boils, reduce heat slightly</li>
	<li>Place pasta in the boiling water</li>
	<li>Cook until pasta is soft but not mushy</li>
	<li>Turn of stove</li>
	<li>Remove pot from the stove</li>
	<li>Drain water from the pot; retain the pasta
		<ol>
			<li>Place a collander in the sink</li>
			<li>Pour all contents into the collander</li>
			<li>Let sit for a minute or so, to allow water to drain</li>
		</ol>
	</li>
	<li>Serve pasta. Suggested accompanying foods include:
		<ul>
			<li>Tomato-based pasta sauce</li>
			<li>Grated parmesan or romano cheese</li>
			<li>Salad</li>
			<li>Mixed squash and zucchini</li>
			<li>Bread</li>
		</ul>
	</li>
</ol>

As with unordered lists, the embedded lists—whether ordered or unordered—are contained completely within a list item ( <li> ) of the parent list.

Creative Commons License
This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 2.5 License.