Sams Teach Yourself HTML 4 in 24 Hours
- Table of Contents
- Copyright
- About the Author
- Acknowledgments
- Tell Us What You Think!
- Put Your HTML Page Online Today
- I. Your First Web Page
- Hour 1. Understanding HTML and XML
- Hour 2. Create a Web Page Right Now
- Hour 3. Linking to Other Web Pages
- Hour 4. Publishing Your HTML Pages
- II. Web Page Text
- Hour 5. Text Alignment and Lists
- Text Alignment
- The Three Types of HTML Lists
- Lists Within Lists
- Summary
- Q&A
- Workshop
- Hour 6. Text Formatting and Font Control
- Hour 7. Email Links and Links Within a Page
- Hour 8. Creating HTML Forms
- III. Web Page Graphics
- Hour 9. Creating Your Own Web Page Graphics
- Hour 10. Putting Graphics on a Web Page
- Hour 11. Custom Backgrounds and Colors
- Hour 12. Creating Animated Graphics
- IV. Web Page Design
- Hour 13. Page Design and Layout
- Hour 14. Graphical Links and Imagemaps
- Hour 15. Advanced Layout with Tables
- Hour 16. Using Style Sheets
- V. Dynamic Web Pages
- Hour 17. Embedding Multimedia in Web Pages
- Hour 18. Interactive Pages with Applets and ActiveX
- Hour 19. Web Page Scripting for Non-Programmers
- Hour 20. Setting Pages in Motion with Dynamic HTML
- VI. Building a Web Site
- Hour 21. Multipage Layout with Frames
- Hour 22. Organizing and Managing a Web Site
- Hour 23. Helping People Find Your Web Pages
- Hour 24. Planning for the Future of HTML
- VII. Appendixes
- A. Readers' Most Frequently Asked Questions
- B. HTML Learning Resources on the Internet
- C. Complete HTML 4 Quick Reference
- D. HTML Character Entities
Lists Within Lists
Although definition lists are officially supposed to be used for defining terms, many Web page authors use them anywhere they'd like to see some indentation. In practice, you can indent any text simply by putting <dl><dd> at the beginning of it and </dd></dl> at the end.
You can indent items further by nesting one list inside another, like the following:
<dl><dd>this item will be indented</dd> <dl><dd>this will be indented further</dd> <dl><dl><dd>and this will be indented very far indeed</dd> </dl></dl></dl></dl>
Just make sure you always have the same number of closing </dl> tags as opening <dl> tags.
Ordered and unordered lists can also be nested inside one another, down to as many levels as you want. In Figure 5.5, a complex indented outline is constructed from several unordered lists. You'll notice in Figure 5.6 that Netscape Navigator automatically uses a different type of bullet for each of the first three levels of indentation, making the list very easy to read.
Figure 5.5 You can build elaborate outlines by placing lists within lists.
Figure 5.6 Multilevel unordered lists are neatly indented and bulleted for readability.
As shown in Figure 5.6, Netscape Navigator (and Microsoft Internet Explorer) will normally use a solid disc for the first-level bullet, a hollow circle for the second-level bullet, and a solid square for all deeper levels. However, you can explicitly choose which type of bullet to use for any level by using <ul type="disc">, <ul type="circle">, or <ul type="square"> instead of <ul>.
You can even change the bullet for any single point in an unordered list by using the type attribute in the <li> tag. For example, the following would display a hollow circle in front of the words Extra and Super, but a solid square in front of the word Special:
<ul type="circle"> <li>extra</li> <li>super</li> <li type="square">special</li> </ul>
The type attribute also works with ordered lists, but instead of choosing a type of bullet, you choose the type of numbers or letters to place in front of each item. Figure 5.7 shows how to use roman numerals (type="I"), capital letters (type="A"), and lowercase letters (type="a") along with ordinary numbers in a multilevel list. In Figure 5.8, you can see the resulting nicely formatted outline.
Figure 5.7 The type attribute lets you make multitiered lists with both numbered and lettered points.
Figure 5.8 A well-formatted outline can make almost any plan look more plausible.
Although Figure 5.7 only uses the type attribute with the <ol> tag, you can also use it for specific <li> tags within a list (though it's hard to imagine a situation where you would want to). You can also explicitly specify ordinary numbering with type="1", and you can make lowercase roman numerals with type="I".
Here's one more seldom-used but handy-when-you-need-it trick: You can start an ordered list with any number (or letter) with the start attribute. <ol start="3">, for example, starts a numbered list at 3 instead of 1. Individual points can be renumbered with the value attribute (<li value="12"> for example).
Summary | Next Section

Account Sign In
View your cart