property

counter-increment — CSS reference

Changes the named counter by an integer, defaulting to one. Negative values decrement; zero leaves the number unchanged. Counter operations follow the CSS counter scope rather than a global JavaScript variable.

Formal Syntax & Structure

css syntaxcss
counter-increment: section 2;

Working Example

Example Snippetcss
<!doctype html><html lang="en"><meta charset="utf-8"><title>CSS reference lab</title><style>#a {counter-reset: section} #a p {counter-increment: section 2} #a p::before {content:counter(section) ". "}</style><body><section id="a"><p>One</p><p>Two</p></section></body></html>
CSS Reference