Javascript examples for CSS Style Property:counterIncrement
The counterIncrement property increments counter values.
Value | Description |
---|---|
none | Default value. No counters will be incremented |
id number | which counter that should be incremented. The default increment is 1. 0 or negative values, are allowed. |
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 counterIncrement property:
<!DOCTYPE html> <html> <head> <style> h1 {//from ww w . j a v a 2 s . co m counter-increment: section; } h1:before { content: "Section " counter(section) " "; } </style> </head> <body> <h1>HTML Tutorial</h1> <h1 id="myH1">CSS Tutorial</h1> <h1>JavaScripts Tutorial</h1> <button onclick="myFunction()">Test</button> <script> function myFunction() { document.getElementById("myH1").style.counterIncrement = "subsection"; } </script> </body> </html>