Glubase - share your knowledge


All / Computers / Programming / CSS





  • View Command

CSS Reference

CSS counter-increment definition

Syntax

counter-increment: none | <identifier>;

Description

The counter-increment property defines if a counter should be incremented each time an element with the property is displayed.

To use the counter-increment property counter-reset needs to be called. If the counter-reset property hasn't been called the default value of the counter is 1.

Values

 

Values Description
none No value will be incremented. Used to override
identifier The counter with the identifier will be incremented.

See Also

counter-reset, content

Example

[Try this example yourself]
<style type="text/css">
h1
{
    counter-reset:chapter;
}
h4:before
{
    counter-increment:chapter;
    content:"Chapter " counter(chapter) ": ";
}
</style>
<h1>Header</h1>
<h4>First Chapter</h4>
<h4>Second Chapter</h4>
<h4>Third Chapter</h4>

Output

Header

First Chapter

Second Chapter

Third Chapter

  • Comments

No comments added.