Numbering and bullets, your way
CSS list markers are not limited to 1. and •. A large set of predefined counter
styles cover numeric, alphabetic, Roman, Greek, CJK and symbolic numbering, and the
@counter-style at-rule lets you invent your own. This reference lists the common
built-ins, the rule’s descriptors, and renders a number into several styles live.
How it works
A counter style maps an integer to a marker string. The built-ins fall into families:
numeric (positional, like decimal), alphabetic (bijective base-N letters),
additive (weighted symbols summed together, like Roman numerals and Hebrew), and
symbolic (a fixed glyph such as disc). The live demo above implements the real
algorithms: bijective base-26 for lower-alpha, subtractive Roman assembly for
upper-roman, and zero-padding for decimal-leading-zero.
To define a custom style, write @counter-style name { system: …; symbols: …; }. The
system chooses the algorithm, symbols or additive-symbols supply the glyphs, and
range, pad, negative, prefix, suffix and fallback refine the output.
Outside the declared range, or for unrepresentable values, the fallback style
(default decimal) takes over.
Tips and examples
- Apply a style with
list-style-type, or reuse it anywhere via thecounter()andcounters()functions incontent. - Always set a sensible
rangeandfallbackfor additive styles so zero and large numbers stay legible. system: extends decimalis the easy way to tweak only the prefix or suffix of an existing style without re-listing every symbol.- Predefined symbolic markers (
disc,circle,square) ignore the counter value — they repeat the same glyph for every item.