concept
Nested counters — CSS reference
A reset with the same counter name in a nested list creates a nested counter. counters() formats all active counters with that name from outermost to innermost, producing hierarchical labels. counter() alone formats only the innermost value.
Formal Syntax & Structure
css syntaxcss
li::before { content: counters(n, ".") " "; }Working Example
Example Snippetcss
<!doctype html><html lang="en"><meta charset="utf-8"><title>Nested counters</title><style>body{margin:0}#a{padding:8px;background:rgb(232,237,241);color:rgb(0,0,0);box-sizing:border-box}body{font:16px/1.5 sans-serif}#a{margin:16px;padding:8px 8px 8px 80px;background:white}li{padding-left:4px}ol{counter-reset:n;list-style:none}li{counter-increment:n}li::before{content:counters(n,".") " "}</style><body><ol id="a"><li>ONE<ol><li>SUBONE</li><li>SUBTWO</li></ol></li><li>TWO</li></ol></body></html>