|
HTML Lists |
IntroductionThere are quite a few ways to implement a list in HTML. But the whole issue is not complicated. You just need to know a few flags. There are two primary styles of lists in HTML: ordered and unordered. Ordered ListsAn ordered list provides a list of items as 1, 2, 3, etc; A, B, C, etc; I,II, III, etc; or a, b, c, etc. By default, when creating an ordered list, the browser assumes the 1, 2, 3 style. Of course, you can change the list style to another style as listed above. You are also allowed to list items inside of already listed items, creating an outline.
To create an ordered list, start the list with the <ol> tag, then provide each item of the list on its own line or paragraph, each item starting with the <li> and ending with the </li> tags. If you want to create a new list inside of an item of the parent list, start the new one with its own <ol> tag. Then list each one of its items inside of its own <li> and </li> tags. Close any child list with its own </ol> tag. As you can create a child list inside of an item of a parent's list, you can also create a "grand-child" list inside of an item of a child list. Unordered ListsAn unordered list is a list that doesn't present any preset policy, except that it is just a a group of items, each on its own line.
You initialize an unordered list with the <ul> tag. Then, each line of the list starts with the <li> tag; closing this tag is optional. Remember to close the list with the </ul> tag. IndentationIn the area of programming, there is such a thing called indentation, and it is also important here. Since we know that most tag have an opening and a closing, and the opening and the closing are usually not on the same line, to keep track of their evolution on the file, you should put the opening and the closing tags on the same distance from the left border of the window: that is indentation. Here is an example:
1 <html> As you can see, when indenting tags, you track the beginning of one and then remember to close. If a certain line of text or paragraph is not too long, its beginning and closing tags could be on the same line. The indentation of tags will also be very important when we learn to use tables. For this tutorial, the <html>, <head>, <title>, and <body> tags will not be indented, they will always be on the most left margin of the window. |
|
Practical Learning: HTML Lists |
As you can see from this code, you don't have to close the <li> tag. |
|
|
||
| Previous | Copyright © 2000-2007 FunctionX, Inc. | Next |
|
|
||