function

counters() — CSS reference

Formats all in-scope counters sharing a name from outermost to innermost, separated by the given string. Useful for nested outline numbering; unlike counter(), it preserves the nesting path.

Formal Syntax & Structure

css syntaxcss
counters(name, "separator", style?)

Working Example

Example Snippetcss
<!doctype html><html lang="en"><meta charset="utf-8"><title>CSS reference lab</title><style>ol {counter-reset:section} li {counter-increment:section} li::before {content:counters(section, ".") " "}</style><body><ol id="a"><li>Parent<ol><li>Child</li></ol></li></ol></body></html>
CSS Reference