What is the CSS counter-reset property?

The counter-reset property in CSSCascade Style Sheets sets or resets the counter values in CSS.


This property is used with the content and the counter-increment property.


Syntax


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

Property values

  • none: It is the default value. We can not reset the value of the counter using this.

  • id: It specifies the counter that has to be reset. The default reset value is 0.

  • initial: This sets the value to its default value.

  • inherit: This inherits the property from its parent value.

Code

The following is the basic HTMLHyperText Markup Language and CSS code to demonstrate the use of the counter-reset property.

Explanation

In this example, we make the counter on Employee. We reset the counter using the counter-reset property. This deletes any previous value in the count, and the count is set to 0.

Free Resources