asp.net.ph

Skip Navigation LinksHome > Abakada: Back to Basics > Authoring Your Web Pages > HTML Elements

HTML Elements

Previous: Using Style Sheets   Next: Anchors and Links


Using Lists in HTML

HTML offers three ways of specifying lists of information. A list must contain one or more items, which may be:

  • Unordered information.
  • Ordered information.
  • Definitions.

Unordered and ordered lists: the UL and OL elements

Ordered and unordered lists are made up of a sequence of list items defined by the <LI> element, whose end tag may be omitted.

The previous list, for instance, is an unordered list, made with the <UL> element:

<ul>
   <li>Unordered information.
   <li>Ordered information.  
   <li>Definitions.
</ul>

An ordered list may be done in a similar manner, using the <OL> element. This type of list is used where order should be emphasized, as in a procedure:

<ol>
   <li>List item 1
   <li>List item 2  
   <li>List item 3
</ol>

Such as in providing step-by-step instructions:

  1. Start an ordered list with the <ol> tag.
  2. Start each list item with the <li> tag.
  3. Write the content of each list item after each <li> tag.
  4. End the ordered list with the </ol> tag.

The start and end tags of both the UL and OL elements are required.

Rendering of unordered and ordered lists

NOTE: This section describes the behavior of some current browsers when formatting lists. Note, however, that attributes for formatting lists have been deprecated in favor of style sheets.

Browsers generally indent lists, to denote each level of nesting.

The TYPE attribute

Both the UL and OL elements have a TYPE attribute for specifying marker rendering options.

For the UL element, possible values are disc, circle, and square. The default value depends on the level of nesting of the current list. These values are case-insensitive.

<ul type="square">
   ... unordered list items ...
</ul>

For the OL element, possible values are summarized in the table below. These values are case-sensitive.

Type Numbering style
1 arabic numbers 1, 2, 3, ...
a lower alpha a, b, c, ...
A upper alpha A, B, C, ...
i lower roman i, ii, iii, ...
I upper roman I, II, III, ...
<ol type="a">
   ... ordered list items ...
</ol>

Note that the TYPE attribute is deprecated and list styles should be handled through style sheets.

The START attribute

The OL element has a start attribute, that may be used to specify the starting number of the first item in an ordered list. For instance:

<ol start=3>

Note that while the value of this attribute is an integer, the corresponding label may be non-numeric.

When the list item style is uppercase Latin letters (A, B, C, ...), start=3 means "C". When the style is lowercase roman numerals, start=3 means "iii", etc.

The VALUE attribute

In ordered lists, it is not possible to continue list numbering automatically from a previous list or to hide numbering of some list items. However, authors can reset the number of an item in an ordered list.

The LI element has a value attribute that can be used to set the number of the current list item. Numbering continues from the new value for subsequent list items. For instance:

<ol>
   <li value="10">makes this list item number 10
   ... other list items ...
</ol>

As in the start attribute, the corresponding label may be non-numeric.

Definition lists: the DL, DT, and DD elements

A definition list may be created using the DL element, and may consist of one or more term / definition pairs.

<dl>
<dt>definition term</dt>
   <dd>definition</dd>
<dt>definition term</dt>
   <dd>definition</dd>
</dl>

Such as in a glossary:

CSS2
Cascading Style Sheets, Level 2
HTML
HyperText Markup Language
PICS
Platform for Internet Content
URL
Uniform Resource Locator

Lists may also be nested, and different list types may be used together, as in the following example, which shows how to publish your HTML files to a Web server. It is a definition list that contains an unordered list (what you need), and an ordered list (what to do):

What you need:
  • a computer
  • a telephone connection
  • a modem
  • access to the Internet
  • an FTP client software
  • your FTP account details
What to do:
  1. connect to the Internet
  2. open your FTP software
  3. connect and log in to your FTP account
  4. make sure that your local and remote folders are set
  5. transfer your files or folders from your machine to the Web server
Note:
Make sure you do not exceed file size limitations.

The exact presentation of these three types of lists depends on the browser.

For the complete list of attributes applicable to lists, see the UL, OL, and DL elements in the HTML Reference.


More ...
Back to top


© 2025 Reynald Nuñez and asp.net.ph. All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note