HTML Lists



index
Disabled back button Next Section
printable version

Section 1: Overview

Simple lists were discussed in the previous HTML5 notes (click Simple Lists to expand it), but they can be much more complex.

Section 2: Ordered Lists

There are some features of ordered lists that were deprecated in older versions of HTML but have now been redefined.

start Attribute

In HTML4 the "start" attribute for the <ol> tag was deprecated, but was reinstated in HTML5.

If you want an ordered list to start numbering at 10 rather than one, use <ol start="10">

  1. Milk
  2. Eggs
  3. Bread

value Attribute

In HTML4 the "value" attribute for the <li> tag was deprecated, but was reinstated in HTML5.

reversed Attribute

The "reversed" attribute allows your list to count backwards.

Section 3: Nested Lists

Since list items can contain paragraphs, images, links, and even other lists, it is very easy to create nested lists.

Section 4: Description Lists (Reference Only)

The HTML <dl> element (or HTML Description List Element) encloses a list of pairs of terms and descriptions.

Description lists were called definition lists in prior versions of HTML, and are created using the tags <dl>, <dt>, and <dd>.

Here is an example of a description list.

Description List

Unordered List
A list of items marked with bullets, much like a grocery list.
Ordered List
A list of items marked with numbers to indicate item ordering.
Description List
An association list consisting of a series of name-value groups.
In previous versions of HTML, these lists were referred to as "Definition lists".

Here is the code:

<h3>Description List</h3>
<dl>
<dt>Unordered List</dt>
<dd>A list of items marked with bullets, much like a grocery list.</dd>
<dt>Ordered List</dt>
<dd>A list of items marked with numbers to indicate item ordering.</dd>
<dt>Description List</dt>
<dd>An association list consisting of a series of name-value groups.</dd>
<dd>In previous versions of HTML, these lists were referred to as "Definition lists".</dd>

</dl>


Since the description list is not too widely used, I'll refer you to The <dl> Tag for a Description List and <dl>: The Description List element for further discussion.

Section 5: Let's Play

Click the "Edit and Click Me >>" to see the results of the html code in the left panel in the panel on the right.

Then, play around with the html code, making changes and seeing the effect of those changes in the right panel.

Section 6: Resources

Here are some additional links about lists that you might find helpful: