CSS Counters Playground

Mrs. Lastri’s numbered poster on the frame: the browser renders your HTML and CSS, counter-reset, counter-increment and counter-set are read off each element…

Why it matters

Tutorial step numbers, chapter headings, nested tables of contents, articles: CSS can number all of them and stay right when items are added, removed or hidden. The confusing part: where a counter is made (counter-reset) decides how far it reaches.

The key idea

counter-reset makes a counter, counter-increment adds, counter-set replaces, counter() reads

Common mistakes

Try it in this playground