| [Index of Lessons] [Lesson 4] [Lesson 6] |
5. Lists |
| Lists can present items of information in an easy-to-read format. Many web pages display lists of items- these may be items preceded with a "bullet" (Unordered) or a sequentially numbered list (Ordered). These lists are easy to format in HTML, and they may even be nested (lists of lists) to produce an outline format. Lists are also handy for creating an index or table of contents to a series of documents or chapters. | |
| Unordered Lists Unordered Lists, or ul tags, are ones that appear as a list of items with "bullets" or markers in the front. |
|
| Ordered Lists Ordered lists are ones where the browser numbers each successive list item starting with "1." |
| Unordered and Ordered Lists | ||
| HTML | Result | |
<B>An Unordered List:</B>
<ul>
<li> Item 1
<li> Item 2
<li> Item 3
</ul>
|
An Unordered List:
|
|
<B>An Ordered List:</B>
<ol>
<li> Item 1
<li> Item 2
<li> Item 3
</ol>
|
An Ordered List:
|
|
| Nested Lists Ordered Lists and Unordered lists can have different levels, each will be indented appropriately by the web browser you use. A major concern will be to verify that each list is properly terminated and the nesting order is correct. |
|
| It can start to look complicated with all of those <ol> <li> </ul> <li> tags floating around, but by remembering the basic structure everything will work out fine. |
| Nested Lists | ||
| HTML | Result | |
<ul><B>Nested Unordered List</B>
<li> Item 1
<li> Item 2
<ul>
<li> Sub Item
<ul>
<li> Sub Item
</ul>
<li> Sub Item
<li> Sub Item
</ul>
<li> Item 3
</ul>
|
|
|
| Nested Lists - Mixing them Not only can you include ordered lists within ordered lists, but you can also mix and match list types. The HTML starts to look pretty ugly, but watch how lists completely contain other lists. |
| Nested Mixed Lists | ||
| HTML | Result | |
<B>Nested Unordered List</B> <ol> <li>Item 1 <li>Item 2 <ul> <li>Sub Item <ol> <li>Sub Item <li>Sub Item <li>Sub Item </ol> <li>Sub Item <li>Sub Item </ul> <li>Item 3 </ol> |
Nested Unordered List
|
|
| Example Now that you have seen more lists than you ever need, let's put them into action. The lists are the prelude to other pages, so soon you will learn how to add links to your work. The lists give the work a more structured to feel to them. We will use an unordered list, because it looks better for the type of web site we are making.
<html> Like before, add all of this to your first web page by opening the document and editing the page. To speed it up, you can cut and paste the code. After you have done all of this, click here (Example 5) to compare your work to the example provided. As you can see, the page is starting to take shape and look more like a web page to get your attention. Next we will look at graphics.
|
|
| Click on Lesson 6 to continue, or click here (Top) to return to the top of document |