aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/css/counter-reset/index.html
diff options
context:
space:
mode:
authorPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
committerPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
commit33058f2b292b3a581333bdfb21b8f671898c5060 (patch)
tree51c3e392513ec574331b2d3f85c394445ea803c6 /files/zh-cn/web/css/counter-reset/index.html
parent8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff)
downloadtranslated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip
initial commit
Diffstat (limited to 'files/zh-cn/web/css/counter-reset/index.html')
-rw-r--r--files/zh-cn/web/css/counter-reset/index.html116
1 files changed, 116 insertions, 0 deletions
diff --git a/files/zh-cn/web/css/counter-reset/index.html b/files/zh-cn/web/css/counter-reset/index.html
new file mode 100644
index 0000000000..e670bedf30
--- /dev/null
+++ b/files/zh-cn/web/css/counter-reset/index.html
@@ -0,0 +1,116 @@
+---
+title: counter-reset
+slug: Web/CSS/counter-reset
+translation_of: Web/CSS/counter-reset
+---
+<div>{{CSSRef}}</div>
+
+<p id="Summary"><br>
+ <code>counter-reset</code> 属性用于将 <a href="/en-US/docs/CSS_Counters">CSS计数器</a> 重置为制定值</p>
+
+<p>{{EmbedInteractiveExample("pages/css/counter-reset.html")}}</p>
+
+<div class="blockIndicator note">
+<p>注意:计数器的值能够通过 CSS 属性 {{cssxref("counter-increment")}} 控制递增或递减。</p>
+</div>
+
+<h2 id="Syntax" name="Syntax">语法</h2>
+
+<pre class="brush:css">/* Set counter-name to 0 */
+counter-reset: counter-name;
+
+/* Set counter-name to -1 */
+counter-reset: counter-name -1;
+
+/* Set counter1 to 1, and counter2 to 4 */
+counter-reset: counter1 1 counter2 4;
+
+/* Cancel any reset that could have been set in less specific rules */
+counter-reset: none;
+
+/* Global values */
+counter-reset: inherit;
+counter-reset: initial;
+counter-reset: unset;
+</pre>
+
+<p><code>counter-reset</code> 属性可以指定为以下之一:</p>
+
+<ul>
+ <li><code>&lt;自定义 ID&gt; [&lt;数值&gt;]</code>。您可以指定任意数量的计数器进行重置,每个名称或“名称-数字”对之间用空格分隔。</li>
+ <li>特殊值 <code>none</code>。</li>
+</ul>
+
+<h3 id="Values" name="Values">可选值</h3>
+
+<dl>
+ <dt>{{cssxref("custom-ident", "&lt;custom-ident&gt;")}}</dt>
+ <dd>要递增的计数器的名称。</dd>
+</dl>
+
+<div class="blockIndicator note">
+<p>该名称由不区分大小写的字母 a 到 z,数字 0 到 9,下划线(_)和 / 或短划线( - )的组合组成,并且第一个非破折号字符必须是一个字母(即,在它的开头没有数字,即使前面有破折号)。此外,在标识符的开头禁止使用两个破折号。在任何案例组合中都不能是 none,unset,initial 或 inherit。</p>
+</div>
+
+<dl>
+ <dt>{{cssxref("&lt;integer&gt;")}}</dt>
+ <dd>每次出现元素时将计数器重置为的值。如果不指定,则默认为 <code>0</code>。</dd>
+ <dt><code>none</code></dt>
+ <dd>该关键字表示不执行计数器重置。它可用于重置隐藏在不太具体的规则中定义的计数器。你可以指定要根据需要重置的计数器,每个计数器用空格分隔。</dd>
+</dl>
+
+<h3 id="语法形式">语法形式</h3>
+
+<pre>{{csssyntax}}</pre>
+
+<h2 id="Examples" name="Examples">示例</h2>
+
+<pre class="brush:css">h1 {
+ counter-reset: chapter section 1 page;
+ /* Sets the chapter and page counters to 0
+ and the section counter to 1. */
+}
+</pre>
+
+<h2 id="Specifications" name="Specifications">规范</h2>
+
+<table class="standard-table">
+ <thead>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>{{SpecName('CSS3 Lists', '#counter-reset', 'counter-reset')}}</td>
+ <td>{{Spec2('CSS3 Lists')}}</td>
+ <td>No change.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('CSS2.1', 'generate.html#propdef-counter-reset', 'counter-reset')}}</td>
+ <td>{{Spec2('CSS2.1')}}</td>
+ <td>Initial definition.</td>
+ </tr>
+ </tbody>
+</table>
+
+<p>{{cssinfo}}</p>
+
+<h2 id="Browser_compatibility" name="Browser_compatibility">浏览器兼容性</h2>
+
+<div>{{Compat("css.properties.counter-reset")}}</div>
+
+<div id="compat-mobile"></div>
+
+<h2 id="See_also" name="See_also">参考</h2>
+
+<ul>
+ <li><a href="/en-US/docs/CSS/Counters" title="CSS/Counters">CSS Counters</a>, {{Cssxref("counter-increment")}}</li>
+ <li>{{cssxref("counter-increment")}}</li>
+ <li>{{cssxref("counter-set")}}</li>
+ <li>{{cssxref("@counter-style")}}</li>
+ <li>{{cssxref("counter")}} and {{cssxref("counters")}} functions</li>
+ <li>{{cssxref("content")}} property</li>
+</ul>