Style counterReset attribute

Definition and usage

counterReset attribute creates or resets one or more counters.

counterReset The attribute is usually used with the counterIncrement attribute and the content attribute.

Example

Change the counter-reset attribute:

document.body.style.counterReset = "section";

Try it yourself

Syntax

Returns the counterReset attribute:

object.style.counterReset

Sets the counterReset attribute:

object.style.counterReset = "none|name number|initial|inherit"

Attribute value

Value Description
none Default value. Does not reset any counters.
name name defines the counter to be reset.
number

Sets the value for the counter each time the selector is encountered.

Default reset value is 0.

initial Sets this property to its default value. See initial.
inherit Inherits this property from its parent element. See inherit.

Technical details

Default value: none
Return value: string that represents the element's counter-reset attribute.
CSS Version: CSS2

Browser Support

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Support Support Support Support Support