Ordered lists have elements that are preceded by numbers or letters and are meant
to provide a sequence of ordered steps for an activity. Such a list might
resemble the following:
1. In Internet Explorer, open the Web page that displays the graphic you wish to
use as wallpaper for your desktop.
2. Right-click the image to open the context menu.
3. Choose Set as Background to save the image and use it as your desktop
wallpaper.
Ordered lists use the ordered list tag (<ol>) to delimit the entire list and the list item
tag (<li>) to delimit each individual list item.
In the preceding example, the list has three elements numbered with Arabic
numbers. This is the default for ordered lists in HTML, as shown in the following
code, whose output is shown in Figure :
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Example Ordered List</title>
</head>
<body>
<ol>
<li>In Internet Explorer, open the Web page that displays
the graphic you wish to use as wallpaper for your
desktop.</li>
<li>Right-click on the image to open the context menu.</li>
<li>Choose Set as Background to save the image and use it
as your desktop wallpaper.</li>
</ol>
</body>
</html>
To specify a different type of identifier for each item, you would use the list-style
attribute and define a style for the list, as shown in the following code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Example Ordered List - Letters</title>
</head>
<body>
<ol style="list-style: upper-alpha">
<li>In Internet Explorer, open the Web page that displays
the graphic you wish to use as wallpaper for your
desktop.</li>
<li>Right-click on the image to open the context menu.</li>
<li>Choose Set as Background to save the image and use it
as your desktop wallpaper.</li>
</ol>
</body>
</html>
This code results in the list items being prefaced with uppercase letters, as shown in Figure .
Currently have 0 comments: