CSS counter-reset

The CSS counter-reset property assists in generating automatic numbering (for example, Heading 1, Heading 2, Heading 2.1 etc) by resetting the count as required.

Every element has a collection of zero or more counters, which are inherited through the document tree. Counters have a name, an integer value, and a creator element. They can also have another counter nested inside themselves.

The counter-reset property creates one or more new counters on an element. Each counter has a name/identifier and a count associated with that identifier.

Syntax

Possible Values

none
This element does not create any new counters.
custom-ident integer?

The element creates one or more new counters. Each custom-ident names a new counter to be created. It's followed by an (optional) integer which provides the counter's starting value. If a starting value isn't provided, it starts at 0.

The counter can then be incremented or decremented with the counter-increment property.

In addition, all CSS properties also accept the following CSS-wide keyword values as the sole component of their property value:

initial
Represents the value specified as the property's initial value.
inherit
Represents the computed value of the property on the element's parent.
unset
This value acts as either inherit or initial, depending on whether the property is inherited or not. In other words, it sets all properties to their parent value if they are inheritable or to their initial value if not inheritable.

General Information

Initial Value
none
Applies To
All elements
Inherited?
No
Media
All

Example Code

Official Specifications