• No results found

Using numbered lists

A numbered list consists of one or more items, each prefaced by a number. Usually, lists are numbered when the order of the items is important.

You use the ordered list element (<ol>) to specify that you’re creating a numbered list, and a list item element (<li>) to mark each item in the list. This bit of markup defines a three-item numbered list:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> <html> <head> <title>Numbered Lists</title> </head> <body> <h1>Things to do today</h1> <ol> <li>Feed cat</li> <li>Wash car</li> <li>Grocery shopping</li> </ol> </body> </html>

Figure 4-15 shows how a browser renders this markup. Notice that you don’t actually have to specify a number for each item in the list, the HTML infers it from the markup.

HTML 4 for Dummies, 4th Edition

by Ed Tittel and Natanya Pitts ISBN:0764519956 John Wiley & Sons © 2003 (408 pages)

Whether your goal is to build a simple, text-oriented Web site or one loaded with frames, graphics, and animation, this step- by-step book will put you on the right track.

Table of Contents

HTML 4 For Dummies, 4th Edition Introduction

Part I - Meeting HTML in Its Natural Environment

Chapter 1 - The Least You Need to Know about HTML and the Web Chapter 2 - HTML at Work on the Web

Chapter 3 - Creating Your First HTML Page Part II - Getting Started with HTML

Chapter 4 - Structuring Your HTML Documents Chapter 5 - Linking to Online Resources Chapter 6 - Finding and Using Images

Chapter 7 - Top Off Your Page with Formatting Part III - Taking HTML to the Next Level

Chapter 8 - HTML Tables Chapter 9 - HTML Frames Chapter 10 - HTML Forms

Part IV - Extending HTML with Other Technologies Chapter 11 - Getting Stylish with CSS

Chapter 12 - HTML and Scripting Chapter 13 - Making Multimedia Magic

Chapter 14 - Integrating a Database into Your HTML Chapter 15 - How HTML Relates to Other Markup Languages Part V - From Web Page to Web Site

Chapter 16 - Creating an HTML Toolbox Chapter 17 - Setting Up Your Online Presence Chapter 18 - Creating a Great User Interface Part VI - The Part of Tens

Chapter 19 - Ten Ways to Exterminate Web Bugs Chapter 20 - Ten HTML Do’s and Don’ts

Part VII - Appendixes Appendix A - HTML 4 Tags

Appendix B - HTML Character Codes Appendix C - Glossary

Index

Cheat Sheet- HTML 4 For Dummies, 4th Edition List of Figures

List of Tables List of Listings List of Sidebars

Figure 4-15: Use the <ol> and <li> attributes to create a numbered list.

If you swap the first two items in the list, their numbers change when the page displays again, as in Figure 4-16. <ol> <li>Wash car</li> <li>Feed cat</li> <li>Grocery shopping</li> </ol>

Figure 4-16: Web browsers set the numbers for your list according to the order items appear in the list.

You can use two different attributes with the <ol> element to control the display of any given list:

start: Specifies what number you want the list to start with. The default starting number is 1, but if you interrupt a list with a paragraph or other block element, and want to pick it up again later, you can specify any number as the start number for the new list.

type: Specifies the numbering style from the list. You can choose from five predefined numbering styles:

1: Decimal numbers

a: Lowercase letters

A: Uppercase letters

i: Lowercase Roman numerals

I: Uppercase Roman numerals

This bit of markup uses ordered list elements and attributes to create a list that uses uppercase Roman numerals and begins numbering at 5 (V in Roman numerals):

HTML 4 for Dummies, 4th Edition

by Ed Tittel and Natanya Pitts ISBN:0764519956 John Wiley & Sons © 2003 (408 pages)

Whether your goal is to build a simple, text-oriented Web site or one loaded with frames, graphics, and animation, this step- by-step book will put you on the right track.

Table of Contents

HTML 4 For Dummies, 4th Edition Introduction

Part I - Meeting HTML in Its Natural Environment

Chapter 1 - The Least You Need to Know about HTML and the Web Chapter 2 - HTML at Work on the Web

Chapter 3 - Creating Your First HTML Page Part II - Getting Started with HTML

Chapter 4 - Structuring Your HTML Documents Chapter 5 - Linking to Online Resources Chapter 6 - Finding and Using Images

Chapter 7 - Top Off Your Page with Formatting Part III - Taking HTML to the Next Level

Chapter 8 - HTML Tables Chapter 9 - HTML Frames Chapter 10 - HTML Forms

Part IV - Extending HTML with Other Technologies Chapter 11 - Getting Stylish with CSS

Chapter 12 - HTML and Scripting Chapter 13 - Making Multimedia Magic

Chapter 14 - Integrating a Database into Your HTML Chapter 15 - How HTML Relates to Other Markup Languages Part V - From Web Page to Web Site

Chapter 16 - Creating an HTML Toolbox Chapter 17 - Setting Up Your Online Presence Chapter 18 - Creating a Great User Interface Part VI - The Part of Tens

Chapter 19 - Ten Ways to Exterminate Web Bugs Chapter 20 - Ten HTML Do’s and Don’ts

Part VII - Appendixes Appendix A - HTML 4 Tags

Appendix B - HTML Character Codes Appendix C - Glossary

Index

Cheat Sheet- HTML 4 For Dummies, 4th Edition List of Figures List of Tables List of Listings List of Sidebars <li>Wash car</li> <li>Feed cat</li> <li>Grocery shopping</li> </ol>

Figure 4-17 shows how the attributes affect the list display in a browser.

Figure 4-17: Use the start and type attributes to guide the display of a numbered list in a browser.