Lists and CSS
Introduction
This document is intended to demonstrate the use of CSS to control the
presentation of lists. For a sample discussing list basics, see lists.html.
Standard list markers
CSS provides several types of list markers.
Unordered lists
By default, an unordered list will generally look like this:
- Food
- Water
- Windbreaker
- Sweatshirt
- Matches
- Flashlight
- Map
But it can be modified to look like this:
- Food
- Water
- Windbreaker
- Sweatshirt
- Matches
- Flashlight
- Map
or this:
- Food
- Water
- Windbreaker
- Sweatshirt
- Matches
- Flashlight
- Map
Ordered lists
By default, an ordered list will generally look like this:
- Write the page using XHTML
- View the page locally with a browser
- Fix any problems in the XHTML
- Transfer the completed page to the server host
- Verify the page permissions
- View the page from the server with a browser
But it can also be made to look like this:
- Write the page using XHTML
- View the page locally with a browser
- Fix any problems in the XHTML
- Transfer the completed page to the server host
- Verify the page permissions
- View the page from the server with a browser
or this:
- Write the page using XHTML
- View the page locally with a browser
- Fix any problems in the XHTML
- Transfer the completed page to the server host
- Verify the page permissions
- View the page from the server with a browser
or this:
- Write the page using XHTML
- View the page locally with a browser
- Fix any problems in the XHTML
- Transfer the completed page to the server host
- Verify the page permissions
- View the page from the server with a browser
Nested lists
These techniques can also be applied to nested lists:
- Apples
- Mcintosh
- Cortland
- Granny Smith
- Braeburn
- Pears
- Bartlett
- Red
- Bosc
- Grapes
- Green, seedless
- Red, seedless
- Concord
Although you would seldom want to mix so many different types of ordered
list markers out in the real world!
Images as list markers
It is also possible to use an image as a list marker (most commonly for
unordered lists). When using an image as a list marker, you may want to
also specify a generic marker shape as a backup in case the image is not
available. Images will take precedence over generic markers when available.
- Food
- Water
- Windbreaker
- Sweatshirt
- Matches
- Flashlight
- Map
Generally, small, simple images work best in this role. When searching
image archives for suitable images, check under the Bullets category.