O'Reilly logo

HTML & CSS: Design and Build Websites by Jon Duckett

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

3

LISTS

  • Numbered lists
  • Bullet lists
  • Definition lists

There are lots of occasions when we need to use lists. HTML provides us with three different types:

  • Ordered lists are lists where each item in the list is numbered. For example, the list might be a set of steps for a recipe that must be performed in order, or a legal contract where each point needs to be identified by a section number.
  • Unordered lists are lists that begin with a bullet point (rather than characters that indicate order).
  • Definition lists are made up of a set of terms along with the definitions for each of those terms.

image

ORDERED LISTS

<ol>

The ordered list is created with the <ol> element.

<li>

Each item in the list is placed between an opening <li> tag and a closing </li> tag. (The li stands for list item.)

Browsers indent lists by default.

Sometimes you may see a type attribute used with the <ol> element to specify the type of bullet point (circles, squares, diamonds and so on). It is better to use the CSS list-style-type property covered on pages 333-335.

image

image

UNORDERED LISTS

image

<ul>

The unordered list is created with ...

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