XML technologies / CSS / Advanced websites with CSS / CSS property reference / list-style-image
(Excerpt from “CSS − Advanced websites with Cascading Stylesheets” by Rachel Andrew & Dan Shafer)
The property list-style-image uses an image file as the marker for list items. Although it can be declared separately for each li item, it is recommended to declare it for the parent list elements ol or ul and let the child li elements inherit it.
When declaring list-style-image, always declare list-style-type as well. The browser uses it as a fallback if the marker image cannot be loaded for any reason.
Note this property’s behaviour during inheritance in nested lists. The description of list-style explains how to avoid the resulting problems.
Inherited: Yes
See also: list-style, list-style-type
Values
A URL (url()) or none.
Default value: none
Compatibility
CSS version: 1
Works in all CSS-capable browsers except Netscape 4.
Example
The first of the following rules uses the image for unordered lists (ul): bullet.gif and uses the marker square as a fallback. The second rule sets list-style-image to none for ordered lists, preventing the image marker from being inherited in nested lists. Decimal numbers are used instead.
ul {
list-style-image: url(/images/bullet.gif);
list-style-type: square;
}
ol {
list-style-image: none;
list-style-type: decimal;
}
Copyright © 2006 of the German translation, dpunkt.verlag GmbH
You may print the online version for your private use.
Otherwise, this chapter from “CSS − Anspruchsvolle Websites mit Cascading Stylesheets” is subject to the same conditions as the bound edition: the work, including all its parts, is protected by copyright. All rights reserved, including reproduction, translation, microfilming, and storage and processing in electronic systems.
dpunkt.verlag GmbH, Ringstraße 19, 69115 Heidelberg