The counter-increment CSS property is used to increase the value of CSS Counters by a given value. The counter’s value can be reset using the counter-reset CSS property.


The name of the counter to increment.
The value to add to the counter. Defaults to 1 if not given.
No counter must be incremented. This is used as the default value, or to cancel an increment in more specific rules.

You may specify as many counters to increment as you want, each separated by a space.


<!DOCTYPE html>
            body {
                counter-reset: section;
            h1 {
                counter-reset: subsection;
            h1:before {
                counter-increment: section;
                content: "Section " counter( section) ". ";
            h2:before {
                counter-increment: subsection;
                content: counter( section) "." counter( subsection) " ";
            IE8 supports these properties only if a !DOCTYPE is specified.
        <h1>HTML tutorials</h1>
        <h2>HTML Tutorial</h2>
        <h2>XHTML Tutorial</h2>
        <h2>CSS Tutorial</h2>
        <h1>Scripting tutorials</h1>
        <h1>XML tutorials</h1>

You may also like...