Javascript examples for CSS Style Property:counterReset
The counterReset property creates or resets one or more counters.
Value | Description |
---|---|
none | Default value. No counters will be reset |
name | The name defines which counter that should be reset |
number | The number sets the value on each occurrence of the selector. The default value is 0 |
initial | Sets this property to its default value. |
inherit | Inherits this property from its parent element. |
Item | Value |
---|---|
Default Value: | none |
Return Value: | A String, representing the counter-increment property of an element |
CSS Version | CSS2 |
Change the counter-reset property:
<!DOCTYPE html> <html> <head> <style> h1:before {//www . j a v a 2 s. co m counter-increment: section; content: "Section " counter(section) ". "; } </style> </head> <body> <button onclick="myFunction()">Test</button> <h1>HTML Tutorials</h1> <h1>JavaScript Tutorials</h1> <h1>CSS Tutorials</h1> <script> function myFunction() { document.body.style.counterReset = "section"; } </script> </body> </html>