concept
Style containment and counters — CSS reference
Style containment scopes counter changes so they do not affect counters outside the contained subtree. This is not a general selector or inheritance boundary. Use an explicit reset when you need a predictable internal sequence.
Formal Syntax & Structure
css syntaxcss
aside { contain: style; }Working Example
Example Snippetcss
<!doctype html><html lang="en"><meta charset="utf-8"><title>Style containment and 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}#a{counter-reset:n}p{counter-increment:n}p::before{content:counter(n) ": "}aside{contain:style}</style><body><section id="a"><p>ONE</p><aside><p>INNER</p></aside><p>THREE</p></section></body></html>