.

Sunday, April 11, 2010

Unordered (Bulleted) Lists

Posted by devlevis | Sunday, April 11, 2010 | Category: , , , , |

Unordered lists are similar to numbered lists except that they use bullets instead of
numbers or letters before each list item. Bulleted lists are generally used when
providing a list of nonsequential items.
 Unordered lists use the unordered list tag (<ul>) 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 each preceded with a small,
round, filled bullet. This is the default for unordered 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 Unordered List</title>
</head>
<body>
<ul>
<li>Vanilla</li>
<li>Chocolate</li>
<li>Strawberry</li>
</ul>
</body>
</html>
Unordered lists also support the list-style-type property, but with slightly
different values:
✦ disc
✦ circle
✦ square
✦ none
The default bullet type is disc, though the client browser can define the default
differently. The different bullet types are shown in Figure .
As with ordered lists, you can define the list-style-position property, which in
the case of unordered lists controls where the bullet appears-outside or inside the
left margin of the item. For example, to move the bullet inside the item margins you
would use a style with the <ul> tag similar to the following:

<ul style="list-style-position: inside;">

Unordered lists support one other type of bullet for each item, an image. The image
for use in unordered lists must fit the following criteria:
✦ Be accessible to the document via HTTP (be on the same Web server or
deliverable from another Web server)
✦ Be in a suitable format for the Web (jpg, gif, or png)
✦ Be sized appropriately for use as a bullet

To specify an image for the list, you use the list-style-image property. This
property has the following syntax:

list-style-image: url(url_to_image);

Currently have 0 comments:


Leave a Reply