Getting HTML Right Part 4 – Lists

Being independent and programming your own webpages.

It is easy just to write your own lists but why do that when HTML offers a couple of excellent solutions. So let's have a look at them.

Here's how a shopping list looks in a bulleted format.

o Potatoes

o Butter

o Eggs

o Cabbage

o Cheese

o Carrots

o Bread

o Rolls

o Shoes

Pretty smart, but how to code it. Let's look. ('s replaced with []' s to invalidate the HTML.)

[UL TYPE = "circle"]

[LI] Potatoes

[LI] Butter

[LI] Eggs

[LI] Cabbage

[LI] Cheese

[LI] Carrots

[LI] Bread

[LI] Rolls

[LI] Shoes

[/ UL]

That's the [UL] tag, (Unordered List). The TYPE attribute gives the choice of bullet. You have "circle", "disc" and "square" to choose from. Each item is preceded by the [LI] tag, (List Item). This generates the bullet and a line break.

But you may like to see your list in an orderly fashion, like this.

A. Potatoes

B. Butter

C. Eggs

D. Cabbage

E. Cheese

F. Carrots

G. Bread

H. Rolls

I. Shoes

This is a so-called Ordered List and makes use of the [OL] tag.

[OL TYPE = "A"]

[LI] Potatoes

[LI] Butter

[LI] Eggs

[LI] Cabbage

[LI] Cheese

[LI] Carrots

[LI] Bread

[LI] Rolls

[LI] Shoes

[/ OL]

Get the idea? Of course you may be super fussy and like to have lists within lists like this. (Asterisks are te illustrate the indent.)

A. Greengrocer

**** a. Potatoes

**** b. Cabbage

**** c. Carrots

B. Dairy

**** I. Butter

*** II. Eggs

** III. Cheese

C. Baker

**** i. Bread

*** ii. Rolls

D. Shoes

As you can see, all is possible as the TYPE attribute gives the choice of the formats A, B, C, etc., a, b, c, etc., 1,2,3, etc., I, II, III , etc. and i, ii, iii, etc. The indentations are automatic.

[OL TYPE = "A"]

[LI] Greengrocer

[OL TYPE = "a"]

[LI] Potatoes

[LI] Cabbage

[LI] Carrots

[/ OL]

[LI] Dairy

[OL TYPE = "I"]

[LI] Butter

[LI] Eggs

[LI] Cheese

[/ OL]

[LI] Baker

[OL TYPE = "i"]

[LI] Bread

[LI] Rolls

[/ OL]

[LI] Shoes

[/ OL]

Its that easy to make your lists in HTML.

This article is one of a series of 6.



Source by Michel Hayes

Leave a Reply