aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/css/integer
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/integer
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/integer')
-rw-r--r--files/zh-cn/web/css/integer/index.html136
1 files changed, 136 insertions, 0 deletions
diff --git a/files/zh-cn/web/css/integer/index.html b/files/zh-cn/web/css/integer/index.html
new file mode 100644
index 0000000000..51a43fdf3a
--- /dev/null
+++ b/files/zh-cn/web/css/integer/index.html
@@ -0,0 +1,136 @@
+---
+title: 整型
+slug: Web/CSS/integer
+tags:
+ - CSS
+ - CSS数据类型
+ - Reference
+ - Web
+translation_of: Web/CSS/integer
+---
+<div>{{CSSRef}}</div>
+
+<p>The <strong><code>&lt;integer&gt;</code></strong> <a href="/en-US/docs/Web/CSS">CSS</a> <a href="/en-US/docs/Web/CSS/CSS_Types">data type</a> is a special type of {{cssxref("number")}} that represents a whole number, whether positive or negative. Integers can be used in numerous CSS properties, such as {{cssxref("column-count")}}, {{cssxref("counter-increment")}}, {{cssxref("grid-column")}}, {{cssxref("grid-row")}}, and {{cssxref("z-index")}}.<br>
+ The <strong><code>&lt;integer&gt; </code></strong>css数据类型是一种特殊的&lt;number&gt;类型,它表示一个整数,无论是正数还是负数。整数可以用于许多css属性,例如{{cssxref("column-count")}}, {{cssxref("counter-increment")}}, {{cssxref("grid-column")}}, {{cssxref("grid-row")}}, and {{cssxref("z-index")}}.</p>
+
+<h2 id="语法">语法</h2>
+
+<p>The <code>&lt;integer&gt;</code> data type consists of one or several decimal digits, 0 through 9 inclusive, optionally preceded by a single <code>+</code> or <code>-</code> sign. There is no unit associated with integers.<br>
+ &lt;integer&gt;数据类型由一个或多个十进制数字组成,包括0到9,可以选择前面加一个+或-号。没有与整数关联的单位。</p>
+
+<div class="note"><strong>Note:</strong> There is no official range of valid <code>&lt;integer&gt;</code> values. Opera 12.1 supports values up to 2<sup>15</sup>-1, IE up to 2<sup>20</sup>-1, and other browsers even higher. During the CSS3 Values cycle there was a lot of discussion about setting a minimum range to support: the latest decision, <a href="http://lists.w3.org/Archives/Public/www-style/2012Apr/0633.html">in April 2012 during the LC phase</a>, was [-2<sup>27</sup>-1; 2<sup>27</sup>-1], but other values like 2<sup>24</sup>-1 and 2<sup>30</sup>-1 <a href="http://lists.w3.org/Archives/Public/www-style/2012Apr/0530.html">were also proposed</a>. However, the latest spec doesn't specify a range anymore.<br>
+注意:没有有效的&lt;integer&gt;值的正式范围。Opera12.1支持高达2<sup>15</sup>-1的值,IE高达2<sup>20</sup>-1的值,其他浏览器支持更高的值。在CSS3值周期中,有很多关于设置最小支持范围的讨论:2012年4月在LC阶段的最新决定是[-2<sup>27</sup>-1; 2<sup>27</sup>-1],,但也提出了2<sup>24</sup>-1 and 2<sup>30</sup>等其他值。但是,最新的规范不再指定范围。</div>
+
+<h2 id="Interpolation">Interpolation</h2>
+
+<p>When animated, values of the <code>&lt;integer&gt;</code> data type are interpolated using discrete, whole steps. The calculation is done as if they were real, floating-point numbers; the discrete value is obtained using the <a href="http://en.wikipedia.org/wiki/Floor_function" title="http://en.wikipedia.org/wiki/Floor_function">floor function</a>. The speed of the interpolation is determined by the <a href="/en-US/docs/Web/CSS/single-transition-timing-function" title="timing-function">timing function</a> associated with the animation.<br>
+ 设置动画时,&lt;integer&gt;数据类型的值将使用离散的完整步骤进行插值。计算过程就像是实数,浮点数一样;离散值是使用floor函数得到的。插值的速度由与动画相关联的定时函数确定。</p>
+
+<h2 id="示例">示例</h2>
+
+<h3 id="合法整型">合法整型</h3>
+
+<pre>12 Positive integer (without a leading + sign)
++123 Positive integer (with a leading + sign)
+-456 Negative integer
+0 Zero
++0 Zero, with a leading +
+-0 Zero, with a leading -
+</pre>
+
+<h3 id="非法整型">非法整型</h3>
+
+<pre class="example-bad">12.0 This is a &lt;number&gt;, not an &lt;integer&gt;, though it represents an integer.
+12. Decimal points are not allowed.
++---12 Only one leading +/- is allowed.
+ten Letters are not allowed.
+_5 Special characters are not allowed.
+\35 Escaped Unicode characters are not allowed, even if they are an integer (here: 5).
+\4E94 Non-arabic numerals are not allowed, even when escaped (here: the Japanese 5, 五).
+3e4 Scientific notation is not allowed.
+</pre>
+
+<h2 id="规范">规范</h2>
+
+<table class="standard-table">
+ <thead>
+ <tr>
+ <th>Specification</th>
+ <th>Status</th>
+ <th>Comment</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>{{SpecName('CSS3 Values', '#integers', '&lt;integer&gt;')}}</td>
+ <td>{{Spec2('CSS3 Values')}}</td>
+ <td>No significant change.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('CSS2.1', 'syndata.html#numbers', '&lt;integer&gt;')}}</td>
+ <td>{{Spec2('CSS2.1')}}</td>
+ <td>Explicit definition.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('CSS1', '', '&lt;integer&gt;')}}</td>
+ <td>{{Spec2('CSS1')}}</td>
+ <td>Implicit definition.</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Browser_compatibility" name="Browser_compatibility">浏览器兼容性</h2>
+
+<div>{{CompatibilityTable}}</div>
+
+<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</td>
+ <td>1.0</td>
+ <td>{{CompatGeckoDesktop("1.0")}}</td>
+ <td>3.0</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>1.0 (85)</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>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<h2 id="参考">参考</h2>
+
+<ul>
+ <li>{{cssxref("&lt;number&gt;")}}</li>
+</ul>