concept

Counter suppression by display none — CSS reference

An element that generates no box because of display:none does not increment or reset counters. visibility:hidden still generates a box and can affect counters. Use this distinction when numbering visible steps.

Formal Syntax & Structure

css syntaxcss
p.hidden { display: none; }

Working Example

Example Snippetcss
<!doctype html><html lang="en"><meta charset="utf-8"><title>Counter suppression by display none</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) ": "}.hidden{display:none}</style><body><section id="a"><p>ONE</p><p class="hidden">TWO</p><p>THREE</p></section></body></html>
CSS Reference