diff options
author | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
---|---|---|
committer | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
commit | 33058f2b292b3a581333bdfb21b8f671898c5060 (patch) | |
tree | 51c3e392513ec574331b2d3f85c394445ea803c6 /files/zh-cn/web/css/counter-increment/index.html | |
parent | 8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff) | |
download | translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2 translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip |
initial commit
Diffstat (limited to 'files/zh-cn/web/css/counter-increment/index.html')
-rw-r--r-- | files/zh-cn/web/css/counter-increment/index.html | 141 |
1 files changed, 141 insertions, 0 deletions
diff --git a/files/zh-cn/web/css/counter-increment/index.html b/files/zh-cn/web/css/counter-increment/index.html new file mode 100644 index 0000000000..379db61b69 --- /dev/null +++ b/files/zh-cn/web/css/counter-increment/index.html @@ -0,0 +1,141 @@ +--- +title: counter-increment +slug: Web/CSS/counter-increment +translation_of: Web/CSS/counter-increment +--- +<div>{{CSSRef}}</div> + +<h2 id="Summary" name="Summary">概要</h2> + +<p><code>counter-increment</code>属性用于将<a href="/en-US/docs/CSS_Counters" title="CSS_Counters">CSS Counters</a>的值增加给定值。可以使用 {{cssxref("counter-reset")}} 属性重置计数器的值。</p> + +<p>{{cssinfo}}</p> + +<h2 id="Syntax" name="Syntax">语法</h2> + +<pre class="brush:css">/* Increment counter-name by 1 */ +counter-increment: counter-name; + +/* Decrement counter-name by 1 */ +counter-increment: counter-name -1; + +/* Increment counter1 by 1, and decrement counter2 by 4 */ +counter-increment: counter 1 counter2 -4; + +/* Do not increment/decrement anything: used to hide less specific values */ +counter-increment: none; + +/* Global values */ +counter-increment: inherit; +counter-increment: initial; +counter-increment: unset; +</pre> + +<h3 id="Values" name="Values">可选值</h3> + +<dl> + <dt>{{cssxref("custom-ident", "<custom-ident>")}}</dt> + <dd>递增的计数器的名称。该标识符由不区分大小写的字母a到z,数字0到9,下划线(_)和/或短划线( - )的组合组成。第一个非破折号字符必须是一个字母(即,在它的开头没有数字,即使前面有破折号。)此外,在标识符的开头禁止使用两个破折号。在任何案例组合中都不能是none,unset,initial或inherit。</dd> + <dt>{{cssxref("<integer>")}}</dt> + <dd>计数器的值。如果没有给出,默认为1。</dd> + <dt><code>none</code></dt> + <dd>不得增加计数器。用作默认值,或取消更具体规则的增量。</dd> +</dl> + + + +<p>你可以根据需要指定要递增的计数器,每个计数器用空格分隔。</p> + +<h3 id="语法形式">语法形式</h3> + +<pre class="syntaxbox">{{csssyntax}} +</pre> + +<h2 id="Examples" name="Examples">示例</h2> + +<pre class="brush: css">h1 { + counter-increment: chapter section 2 page; + /* Increases the value of the chapter and page counters by 1 + and the section counter by 2. */ +} +</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-increment', 'counter-increment') }}</td> + <td>{{ Spec2('CSS3 Lists') }}</td> + <td>No change.</td> + </tr> + <tr> + <td>{{SpecName('CSS2.1', 'generate.html#propdef-counter-increment', 'counter-increment')}}</td> + <td>{{Spec2('CSS2.1')}}</td> + <td>Initial definition.</td> + </tr> + </tbody> +</table> + +<h2 id="Browser_Compatibility" name="Browser_Compatibility">浏览器兼容性</h2> + +<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.0 (?)</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> + +<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-reset")}}</li> +</ul> |