CSS Library: Other: Here
Customizing Order List style using CSS
Author: Dynamic Drive
Styling the automatically generated number counters in ordered lists (<ol>)
can be challenging. This CSS code demonstrates one way to do it by getting rid
of the default ones first, then using CSS generated content to create custom
counters instead. Specifically, we turn to
CSS generated counters, using the "before:" pseudo element and
setting its content to "counter". The result is custom counters
that can be styled using all the powers of CSS! The custom style works in all
modern browsers- IE9+, FF, Chrome, Safari etc.
In the below demo, each level of OL carries a slightly varied style from that of its' parent's (up to the 3rd level).
- this is a list 1
- this is a list 1
- this is a list 2
- this is a list 2
- this is a list 3
- this is a list 3
- this is a list 3
- this is a list 3
- this is a list 2
- this is a list 2
- this is a list 1
- this is a list 1
- this is a list 1
The CSS:
Got a question or need help customizing this CSS code? Post it in the CSS Forums. If you have a comment or suggestion instead, post it in the comments section below.
Commenting is not available in this weblog entry.
