/

HTML / CSS / JavaScript Tutorial

CSS Pseudo-Property: counter-increment

[this page | pdf | back links]

The CSS (CSS2) counter-increment (pseudo-)property increments one or more CSS counter values and is usually used in conjunction with the counter-reset and content pseudo-properties.

 

For example, a selector taking the following form will increment the counter named ctr by 2 each time the relevant selector is selected (here each time the page load comes across an <h2> element)

 

h2 { counter-increment: ctr 2; }

 

Property values (other than inherit and initial) that can be included in the pseudo-property include:

 

Value

Description

id value

The id of the counter to be incremented and the value that the counter is to be incremented by (can be negative or zero, default is 1)

none

(default). No counters incremented

 

Default Value:

none

JavaScript syntax:

e.g. object.style.counterIncrement="ctr"

Inherited:

No

Animatable:

No

 


NAVIGATION LINKS
Contents | Prev | Next | CSS Properties


Desktop view | Switch to Mobile