XML technologies / CSS / Advanced websites with CSS / CSS property reference / list-style
(Excerpt from “CSS − Advanced websites with Cascading Stylesheets” by Rachel Andrew & Dan Shafer)
The shorthand property list-style allows the list properties list-style-image, list-style-position and list-style-type to be declared together in a single statement.
All three settings are optional. A property that is not declared uses its default value.
This property has an effect only when the property display of the element concerned is set to list-item. It is recommended to declare this property for the parent list so that child lists can simply inherit the setting.
Inherited: Yes
See also: list-style-image, list-style-position and list-style-type
Value
The syntax of the property list-style is structured as follows. Values are separated by spaces:
list-style: [type] [position] [image]
Each of the three values is optional, but at least one must be present. For type, any valid value of list-style-type, for position, any valid value of list-style-position, and for image, any valid value of list-style-image may be specified. The order is arbitrary.
If values are specified for type and image, the setting of type is used if the image cannot be loaded.
If the property is set to none, both list-style-image and list-style-type are set to none.
Default value: none
Compatibility
CSS version: 1
Works in all CSS-capable browsers.
Netscape 4 does not support list-style-image or list-style-position; neither property has any effect there.
Example
The following style rules specify an image for items in unordered lists and Roman numerals for items in ordered lists:
ul {
list-style: url(/images/bullet.gif);
}
ol {
list-style: upper-roman;
}The following style rules produce the same result, provided that the lists are not nested:
ul {
list-style-image: url(/images/bullet.gif);
}
ol {
list-style-type: upper-roman;
}With nested lists, the two variants differ. Consider, for example, an ordered list (ol) nested inside an unordered list (ul): in the first example, the ordered list correctly displays Roman numerals. In the second, however, it inherits the image as its list marker. This does not happen in the first example: the declaration list-style: upper-roman automatically sets list-style-image to the default value none, because it is not explicitly declared in the style rule.
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