B.27. counter-reset

This property sets a named counter (for display with the content property), to a particular value, each time the enclosing style rule is matched.

By default, the counter is reset to zero, but you can specify any value you like.

Inherited: No

See also: Section B.26counter-increment

B.27.1. Value

A counter name, optionally followed by a positive or negative integer that specifies the new value for the counter (the default it 0). If you want to set multiple counters for a single element, you can separate their names (and optional integers) by spaces.

The default value, none is also supported, but is of little practical use.

Initial value: none

B.27.2. Compatibility

CSS Version: 2

Not supported by any currently-available browser.

B.27.3. Example

This example lets you use h1 elements to mark chapters, h2 elements to mark subsections, and have hierarchical numbering on section headings:

h1 {
  counter-increment: chapter;
  counter-reset: section;
}
h1:before {
  content: "Chapter " counter(chapter) " - ";
}
h2 {
  counter-increment: section;
}
h2:before {
  content: "Section " counter(chapter) "." counter(section) " - ";
}

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.222.138.230