counter++

counter-increment

Add 1 to a CSS counter that is declared elsewhere.

Property values

The counter-increment property is used in tandem with the counter-reset property. They both expect a counter-name, which is arbitrarily chosen.

Each element of a document that matches a selector which has a counter-increment property will cause that property-name to increase in value by 1.

Examples

/* Using a CSS counter */
h1:first-of-type {
counter-reset: C;
}
h1::before {
counter-increment: C;
content: "Section " counter(C) ":";
}
counter-increment
0

style > generate > counter-incrementcounter++

🔗 🔎