Skip to Content
CSS Cookbook, 3rd Edition
book

CSS Cookbook, 3rd Edition

by Christopher Schmitt
December 2009
Intermediate to advanced
728 pages
15h 59m
English
O'Reilly Media, Inc.
Content preview from CSS Cookbook, 3rd Edition

Chapter 6. Lists

Introduction

From a wife handing her husband a grocery list as he steps out the door to a music channel presenting its top 100 worst songs of all time, lists help people stay focused and organized.

In web design, it’s the same case.

HTML lists facilitate the presentation of organized content to your site’s visitors by grouping key elements together. Also, HTML lists are appealing in part because of the way they appear on the page.

List items are typically indented and keyed off by a marker, usually by a filled circle for an unordered list or numbers for an ordered list (see Figure 6-1).

With a few lines of HTML, a web coder can create a bulleted list on a web page without opening an image editor. With CSS, you can create even more visually compelling lists.

With a few simple CSS rules, however, web developers can tailor the presentation of that same list to complement the design of a web page instead of relying on the stodgy browsers’ default styling.

This chapter illustrates how to change the numbering of list items, use your own image for a list marker, create a hanging indent that doesn’t use a list marker, and more.

Changing the Format of a List

Problem

You want to change the default list style—for example, to change the bullet or numbering, as shown in Figure 6-2.

The default rendering of a list
Figure 6-1. The default rendering of a list
Figure 6-2. The list markers changed to lowercase roman numerals ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

CSS Master, 3rd Edition

CSS Master, 3rd Edition

Tiffany B Brown
CSS in Depth

CSS in Depth

Keith Grant
Mastering CSS

Mastering CSS

Rich Finelli

Publisher Resources

ISBN: 9781449377250Errata Page