Developer

Creating HTML lists

There are times when a list is the best way to organize a lot of information on your Web page. HTML contains some list-making tags to help you get started.

By Fred Dekker and Donald St. John

Sometimes a list is the best way to organize a lot of information. For instance, you could use a list of links as a table of contents for a particularly long FAQ file. HTML contains a variety of list-making tags to help you get started.

The simplest and most common is an unordered or bulleted list, denoted by a <UL> tag. This type of list places bullets before each list item, which you designate with an <LI> tag (for "list item"). If we apply this tag to the three reasons to check out more information about E-Z Accounting, the code looks like this:

Ready to save yourself some money? Let E-Z Accounting tell you more about our

<UL>
<LI><A HREF="services.html">Services</A>
<LI><A HREF="fees.html">Fees</A>
<LI><A HREF="backgrnd.html">Background</A>
</UL>

To get an ordered, or numbered, list, we'd replace the <UL> tags with <OL> tags; the <LI> tags remain the same:

Ready to save yourself some money? Let E-Z Accounting tell you more about our

<OL>
<LI><A HREF="services.html">Services</A>
<LI><A HREF="fees.html">Fees</A>
<LI><A HREF="backgrnd.html">Background</A>
</OL>

Because our example doesn't consist of a series of steps, let's change the <OL> back to <UL> to imply options rather than a sequential order.

A third type of list is the definition list, which is used primarily for glossaries. A definition list presents a term on one line and then its definition on a separate line. This type of list uses the <DL> tag and denotes list elements with <DT> (for "definition title") and <DD> (for "definition description"), like this:

<DL>
<DT>1040<br>
<DD>The basic form you have to fill out for a tax return.<br>
<DT>Schedule C<br>
<DD>The form you have to fill out to declare self-employment income.</DL>

Fred Dekker is one of the Founders of The H.E.L.P. Community, an online resource for beginning Webmasters.

Donald St. John was the founding Webmaster at PC Games magazine.

Editor's Picks