HTML | DOM Style counterReset Property

The Style counterReset property in HTML DOM is used to create or reset counters. This property is used with the counterincrement property and the content property.


  • It is used to return the counterReset property.
  • It is used to set the counterReset property. = "none|name|number|initial|inherit"

Property values

Value Description
none It is the default value no counter will be reset.
name It holds the name of the counter which counter will be reset.
number It holds the number which counter eill be reset.
initial Set this property to it’s default value.
inherit Inherits the property from it’s parent element.

Return Value:This method returns a string containing counter-increment property of element.






<!DOCTYPE html>
        HTML DOM Style counterReset Property
        p:before {
            counter-increment: subj;
            content: "Subject " counter(subj) ": ";
        HTML DOM Style counterReset Property
    <button onclick = "myFunction()">
        Click Here!
    <h2>Computer Science Subjects</h2>
    <p>Data Structure</p>
    <p>Operating System</p>
    <p>Computer Networks</p>
        function myFunction() {
   = "subj";


Before click on the button:

After click on the button:

Supported Browsers: The browser supported by DOM counterReset property are listed below:

  • Google Chrome
  • Internet Explorer
  • Firefox
  • Opera
  • Safari


My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using or mail your article to See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

Article Tags :
Practice Tags :

Be the First to upvote.

Please write to us at to report any issue with the above content.