Home
CSS
CSS Counters
Tryit: Nesting counters
Run ❯
Get your
own
website
Result Size:
625 x 534
×
Change Orientation
Save Code
Change Theme, Dark/Light
Go to Spaces
<!DOCTYPE html> <html> <head> <style> body { counter-reset: section; } h1 { counter-reset: subsection; } h1::before { counter-increment: section; content: "Section " counter(section) ". "; } h2::before { counter-increment: subsection; content: counter(section) "." counter(subsection) " "; } </style> </head> <body> <h1>HTML/CSS Tutorials</h1> <h2>HTML</h2> <h2>CSS</h2> <h2>Bootstrap</h2> <h2>W3.CSS</h2> <h1>Scripting Tutorials</h1> <h2>JavaScript</h2> <h2>jQuery</h2> <h2>React</h2> <h1>Programming Tutorials</h1> <h2>Python</h2> <h2>Java</h2> <h2>C++</h2> </body> </html>