CSS counter-reset Property

The counter-reset property resets one or more CSS counter to a given value. This property is usually used with the content and counter-increment properties. The counter-reset property is specified by two values: none and id numbers. "None" is the default value of this property. Negative values are allowed.

Initial Value none
Applies to All elements.
Inherited No.
Animatable No.
Version CSS2
DOM Syntax object.style.counterReset = "section" ;


counter-reset: none | name number | initial | inherit;

Click "Try it" button to set the counter-reset property.


<!DOCTYPE html>
    <title>Title of the document</title>
      h2::before {
      counter-increment: section;
      content: "Book " counter(section) ". ";
    <p>Click the "Try it" button to set the counter-reset property:</p>
    <button onclick="myFunction()">Try it</button>
    <h2>HTML Tutorials</h2>
    <h2>JavaScript Tutorials</h2>
    <h2>CSS Tutorials</h2>
      function myFunction() {
        document.body.style.counterReset = "section";


Value Description
none Counters are not incremented.
name number Name defines the name of the counter to reset. Number defines the value to reset the counter to on each occurrence of the element. Defaults to 0 if not specified.
initial Sets the property to its default value.
inherit Inherits the property from its parent element.

Related articles