O'Reilly logo

HTML, XHTML, and CSS Bible, Fourth Edition by Steven M. Schafer

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 7. Lists

IN THIS CHAPTER

  • Understanding lists

  • Ordered (numbered) lists

  • Unordered (bulleted) lists

  • Definition lists

  • Nested lists

HTML and its various derivatives were originally intended to reproduce only academic and research text. For this reason, particular care was taken to ensure specific elements, such as lists and tables, were implemented and robust enough to handle the tasks for which they serve.

In the case of lists, HTML defines three different types of lists: ordered lists (numbered), unordered lists (bulleted), and definition lists (term and definition pairs). This chapter covers all three types of lists and the various syntax and formatting possibilities of each.

Understanding Lists

All lists, whether ordered, unordered, or definition, share similar elements. Each HTML list has the following structure:

<list_tag>
  <item_tag>Item text</item_tag>
  <item_tag>Item text</item_tag>
  ...
</list_tag>

Note

Definition lists are slightly different in syntax because they use a term tag (<dt>) and a definition description tag (<dd>). See the "Definition Lists" section later in this chapter for more information.

For each list, you need the list opening tag, a corresponding closing tag, and individual item tags for each element actually in the list. Essentially, the entire list must delimited by list open and close tags, with list items appearing between the two tags with open and close tags of their own. This structure will become abundantly clear throughout the chapter.

Each type of list has ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required