Chapter 4 (Lists)
Chapter 4 (Lists)
Introduction to HTML
Chapter 4 - Lists
1
Lists
2
List Elements
HTML supplies several list elements. Most list elements
are composed of one or more <LI> (List Item) elements.
UL : Unordered List. Items in this list start with a list mark
such as a bullet.
<UL>
<LI> List item 1 </LI>
<LI> List item 2 </LI>
</UL>
• List item 1
3
• List item 2
List Elements
You have the choice of three bullet types: disc(default),
circle, square.
These are controlled in Netscape Navigator by the
“TYPE” attribute for the <UL> element.
<UL TYPE=square>
<LI> List item 1</LI>
<LI> List item 2</LI>
<LI> List item 3</LI>
</UL>
List item 1
List item 2
List item 3 4
List Elements
OL: Ordered List. Items in this list are numbered
automatically by the browser.
<OL>
<LI> List item 1</LI>
<LI> List item 2</LI>
<LI> List item 3</LI>
</OL>
1. List item 1
2. List item 2
3. List item 3
6
List Elements
You can specify a starting number for an ordered
list.
<OL TYPE =i>
<LI> List item …</LI>
<LI> List item …</LI>
</OL>
<P> Text ….</P>
<OL TYPE=i START=3>
<LI> List item …</LI>
</OL>
7
List Elements
i. List item …
ii. List item …
Text ….
8
List Elements
DL: Definition List. This kind of list is different from the
others. Each item in a DL consists of one or more
Definition Terms (DT elements), followed by one or
more Definition Description (DD elements).
<DL>
<DT> HTML </DT>
<DD> Hyper Text Markup Language </DD>
<DT> DOG </DT>
<DD> A human’s best friend!</DD>
</DL>
HTML
Hyper Text Markup Language
DOG
A human’s best friend!
9
Nesting Lists
You can nest lists by inserting a UL, OL, etc., inside a list
item (LI).
Example:
<UL TYPE = “square”>
<LI> List item …</LI>
<LI> List item …
<OL TYPE=i START=3>
<LI> List item …</LI>
<LI> List item …</LI>
<LI> List item …</LI>
<LI> List item …</LI>
<LI> List item …</LI>
</OL>
</LI>
<LI> List item …</LI> 10
</UL>
What will be the output?
<H1 ALIGN="CENTER">SAFETY TIPS FOR CANOEISTS</H1>
<OL TYPE=a START=2>
<LI>Be able to swim </LI>
<LI>Wear a life jacket at all times </LI>
<LI>Don't stand up or move around. If canoe tips,
<UL>
<LI>Hang on to the canoe </LI>
<LI>Use the canoe for support and </LI>
<LI>Swim to shore
</UL> </LI>
<LI>Don't overexert yourself </LI>
<LI>Use a bow light at night </LI>
</OL>
11
The output….
12
<H1 ALIGN="CENTER">SAFETY TIPS FOR
CANOEISTS</H1>
<OL TYPE="a" START="2">
<LI>Be able to swim </LI>
<LI>Wear a life jacket at all times </LI>
<LI>Don't stand up or move around. If canoe tips,
<UL>
<LI>Hang on to the canoe </LI>
<LI>Use the canoe for support What
<OL type="I" start="4">
<LI> Be careful </LI>
will
<LI> Do not look around</LI> be the
</LI> </OL> output?
<LI>Swim to shore
</UL> </LI>
<LI>Don't overexert yourself </LI>
<LI>Use a bow light at night </LI>
13
</OL>
The output….
14