Lists and Paragraphs

Paragraphs in HTML start and end with the <P> and </P> tags.

HTML defines five kinds of lists:

All list tags have common elements:

Numbered Lists

Numbered lists are surrounded by the Ordered List tags <OL> and </OL>. Each item within the list begins with the <LI> tag. The <LI> tag is a one sided tag, it doesn't need to be followed by a </LI>. Here is an example of a numbered list:

How to start a car:

  1. Get into the car.
  2. Put key in ignition.
  3. While tuning the key, push on the gas.

And here is the code:

<P>How to start a car:</P>
<OL>
<LI> Get into the car.
<LI> Put key in ignition.
<LI> While tuning the key, push on the gas.
</OL>

Unordered Lists

An unordered list is simular to a Numbered list except that the numbers are replaced by a "bullet" or marker. Unordered lists are surrounded by <UL> at the beginning and followed by </UL>. As in a numbered list each item is preceded by a </LI>. Here is an example of an unordered list:

Rooms in a house:

Here is the code:

<P>Rooms in a house:</P>
<UL>
<LI>Living room.
<LI>Dinning room.
<LI>Bedroom.
<LI>Den.
</UL>

Glossary Lists

Glossary lists, or definition lists, are slightly different from other lists. Each list item in a glossary list has two parts:

Here is an example of a glossary list:

Some HTML tags and there meanings:

H1
The largest of the Heading fonts.
H2
The next largest Heading font.
H3 thru H6
As the number gets larger, the font gets smaller.

And here is the code:

<P>Some HTML tags and there meanings:</P>
<DL>
<DT>H1<DD>The largest of the Heading fonts.
<DT>H2<DD>The next largest Heading font.
<DT>H3 thru H6<DD>As the number gets larger, the font gets smaller.
</DL>

There is also a "COMPACT" version for the glossary tag. You mearly write COMPACT after the DL like this <DL COMPACT>. The tailing </DL> does not change. Here is the same example as above with the COMPACT attribute:

Some HTML tags and there meanings:

H1
The largest of the Heading fonts.
H2
The next largest Heading font.
H3 thru H6
As the number gets larger, the font gets smaller.

And here is the code:

<P>Some HTML tags and there meanings:</P>
<DL COMPACT>
<DT>H1<DD>The largest of the Heading fonts.
<DT>H2<DD>The next largest Heading font.
<DT>H3 thru H6<DD>As the number gets larger, the font gets smaller.
</DL>

Since I believe that Menu and Directory list are no longer supported by the HTML specification. I will not go into them. Most browsers treat them as unordered lists.

Menu List

  • one
  • two
  • three
  • Directory List

  • one
  • two
  • three
  • Nesting Lists

    Lists may also be nested inside of each other. Here is an example of a nested list:

    Departments on my seismic vessel

    1. The Marine crew
    2. The Instrument Department
    3. Machanics
    4. Navigators

    Here is the code:

    <P>Departments on my seismic vessel</P>
    <OL>
    <LI>The Marine crew
    <LI>The Instrument Department
    <UL>
    <LI>Don
    <LI>Jim
    <LI>Lief
    <LI>Eric
    </UL>
    <LI>Machanics
    <LI>Navigators
    </OL>