mozilla

Revision 20547 of counter-reset

  • Revision slug: CSS/counter-reset
  • Revision title: counter-reset
  • Revision id: 20547
  • Created:
  • Creator: teoli
  • Is current revision? No
  • Comment 3 words added

Revision Content

{{ CSSRef() }}

Summary

The counter-reset CSS property is used to reset CSS Counters to a given value.

  • {{ Xref_cssinitial() }}:
  • Applies to: all elements
  • {{ Xref_cssinherited() }}: no
  • Percentages: N/A
  • Media: {{ Xref_cssvisual() }}
  • {{ Xref_csscomputed() }}:

Syntax

counter-reset: [<identifier> <integer>?]+ | inherit | none

Values

identifier
The name of the counter to reset.
integer
The value to reset the counter to on each occurrence of the element. Defaults to 0 if not given.

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

Related properties

Examples

h1 {
  counter-reset: chapter section 1 page;
  /* Sets the chapter and page counters to 0
     and the section counter to 1. */
}

Notes

Specifications

Browser compatibility

{{ CompatibilityTable() }}

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support 2.0 1.0 (?) 8.0 9.2 3.1 (?)
Feature Android Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile
Basic support {{ CompatUnknown() }} {{ CompatUnknown() }} {{ CompatUnknown() }} {{ CompatUnknown() }} {{ CompatUnknown() }}

See also

CSS Counters, {{ Cssxref("counter-increment") }}

{{ languages( { "fr": "fr/CSS/counter-reset", "pl": "pl/CSS/counter-reset" } ) }}

Revision Source

<p>{{ CSSRef() }}</p>
<h3 name="Summary">Summary</h3>
<p>The <code>counter-reset</code> <a href="/en/CSS" title="CSS">CSS</a> property is used to reset <a href="/en/CSS_Counters" title="en/CSS_Counters">CSS Counters</a> to a given value.</p>
<ul> <li>{{ Xref_cssinitial() }}:</li> <li>Applies to: all elements</li> <li>{{ Xref_cssinherited() }}: no</li> <li>Percentages: N/A</li> <li>Media: {{ Xref_cssvisual() }}</li> <li>{{ Xref_csscomputed() }}:</li>
</ul>
<h3 name="Syntax">Syntax</h3>
<pre class="eval">counter-reset: [&lt;identifier&gt; &lt;integer&gt;?]+ | inherit | none
</pre>
<h3 name="Values">Values</h3>
<dl> <dt>identifier</dt> <dd>The name of the counter to reset.</dd> <dt>integer</dt> <dd>The value to reset the counter to on each occurrence of the element. Defaults to 0 if not given.</dd>
</dl>
<p>You may specify as many counters to reset as you want, each separated by a space.</p>
<h3 name="Related_properties">Related properties</h3>
<ul> <li><a href="/en/CSS/counter-increment" title="en/CSS/counter-increment">counter-increment</a> increases the value of specified <a href="/en/CSS_Counters" title="en/CSS_Counters">CSS Counters</a> by a given amount.</li>
</ul>
<h3 name="Examples">Examples</h3>
<pre>h1 {
  counter-reset: chapter section 1 page;
  /* Sets the chapter and page counters to 0
     and the section counter to 1. */
}
</pre>
<h3 name="Notes">Notes</h3>
<h3 name="Specifications">Specifications</h3>
<ul> <li><a class="external" href="http://www.w3.org/TR/CSS21/generate.html#propdef-counter-reset">CSS 2.1</a></li>
</ul>
<h3 name="Browser_Compatibility">Browser compatibility</h3>
<p>{{ CompatibilityTable() }}</p>
<div id="compat-desktop"> <table class="compat-table"> <tbody> <tr> <th>Feature</th> <th>Chrome</th> <th>Firefox (Gecko)</th> <th>Internet Explorer</th> <th>Opera</th> <th>Safari (WebKit)</th> </tr> <tr> <td>Basic support</td> <td>2.0</td> <td>1.0 (?)</td> <td>8.0</td> <td>9.2</td> <td>3.1 (?)</td> </tr> </tbody> </table>
</div>
<div id="compat-mobile"> <table class="compat-table"> <tbody> <tr> <th>Feature</th> <th>Android</th> <th>Firefox Mobile (Gecko)</th> <th>IE Phone</th> <th>Opera Mobile</th> <th>Safari Mobile</th> </tr> <tr> <td>Basic support</td> <td>{{ CompatUnknown() }}</td> <td>{{ CompatUnknown() }}</td> <td>{{ CompatUnknown() }}</td> <td>{{ CompatUnknown() }}</td> <td>{{ CompatUnknown() }}</td> </tr> </tbody> </table>
</div>
<h3 name="See_also">See also</h3>
<p><a href="/en/CSS_Counters" title="en/CSS_Counters">CSS Counters</a>, {{ Cssxref("counter-increment") }}</p>
<p>{{ languages( { "fr": "fr/CSS/counter-reset", "pl": "pl/CSS/counter-reset" } ) }}</p>
Revert to this revision