Counter styles

You can define your own unique counter style with @counter-style. Specify the counter-style name, the counter-system type in 'system', and the counter-symbol in 'symbols'. Names specified in the counter-style rule can be used in the 'list-style-type' property in CSS. The @counter-style rule must be placed in the CSS stylesheet. You may also use styles defined in Predefined Counter Styles, including styles in Section 7, Complex Predefined Counter Styles. For further details on CSS Counter Styles Level 3, please refer to the W3C specification. Counter style settings are available in modern web browsers.

These samples, with some exceptions, convert the numerals in the character string "One: 1, Two: 2, Three: 3, Four: 4, Five: 5, Six: 6" by using the 'counter()' function with a counter style defined in a @counter-style rule. The numbers to be converted are in red.

system="cyclic" symbols="a b c"

Converts the numerals in the character string into the repeating sequence a, b, c, a, b, c ...

One: , Two: , Three: , Four: , Five: , Six:

system="numeric" symbols="a b c"

The first symbol, 'a', corresponds to 0, so the converted numerals start from 'b'.

One: , Two: , Three: , Four: , Five: , Six:

system="alphabetic" symbols="a b c"

Converts the numerals in the character string into the sequence a, b, c, aa, ab, ac, ba, bb, bc, ...

One: , Two: , Three: , Four: , Five: , Six:

system="symbolic" symbols="a b c"

Converts the numerals in the character string into the sequence a, b, c, aa, bb, cc, aaa, bbb, ccc, ...

One: , Two: , Three: , Four: , Five: , Six:

system="additive" additive-symbols="5 v,1 i"

Converts the numerals in the character string by converting 5 to v and remainder multiples of 1 to the same number of i.

One: , Two: , Three: , Four: , Five: , Six:

system="fixed" symbols="a b c"

Converts the numerals in the character string into the sequence a, b, c and then displays higher numbers unchanged.

One: , Two: , Three: , Four: , Five: , Six:

system="extends decimal" pad="2 '0'"

'pad' specifies padding for short representations. This displays up to 2 digits in the sequence 01, 02, 03, ...

One: , Two: , Three: , Four: , Five: , Six:

system="cyclic" symbols="a b c" range="1 3" fallback="cjk-decimal"

'range' specifies the number range to which the style applies. 'fallback' specifies the fallback style for numbers outside that range. This sample applies a, b, c for numerals 1 to 3. It then falls back to using the 'cjk-decimal' style for 4 and above.

One: , Two: , Three: , Four: , Five: , Six:

system="extends decimal" negative="[-" "]"

'negative' specifies the prefix and suffix character strings for negative values. This sample displays '[-' before, and ']' after, negative values.

Negative One:, Negative Two:, Negative Three:, Negative Four:, Negative Five:, Negative Six:

Complex Predefined Counter Styles

Examples from Section 7, Complex Predefined Counter Styles, of Predefined Counter Styles.

'circled-decimal'

One: , Two: , Three: , Four: , Five: , Six:

'filled-circled-decimal'

One: , Two: , Three: , Four: , Five: , Six:

'fullwidth-upper-alpha'

One: , Two: , Three: , Four: , Five: , Six:

'lower-greek'

One: , Two: , Three: , Four: , Five: , Six:

'japanese-informal'

One: , Two: , Three: , Four: , Five: , Six:

'japanese-formal'

One: , Two: , Three: , Four: , Five: , Six: