mozilla

Revision 7590 of <integer>

  • Revision slug: CSS/integer
  • Revision title: integer
  • Revision id: 7590
  • Created:
  • Creator: teoli
  • Is current revision? No
  • Comment 2 words added, 1 words removed

Revision Content

{{ CSSRef() }}

Summary

The <integer> CSS data type represent an integer number, positive or negative. There isn't any associated unit with the value. An integer consists of one or several decimal digit, 0 to 9, eventually preceded by one single + or - sign.

Integers are used e.g. in CSS {{ Xref_csscolorvalue() }} values and in these CSS properties:
{{ cssxref("z-index") }}, {{ cssxref("line-height") }}, {{ cssxref("counter-increment") }}, {{ Cssxref("-moz-column-count") }}.

Examples

These are valid integer values:

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 - (Though strange, this is an allowed value)

These are invalid integer values:

12.0        This is a <number>, though it represents an integer
12.         The dot should not be part of an <integer>
+---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 escaped (here: the Japanese 5, 四)

{{ languages( { "es": "es/CSS/integer", "ja": "ja/CSS/integer" } ) }}

Specifications

Specification Status Comment
CSS Values and Units Level 3 {{ Spec2('CSS3 Values') }} No significant change from CSS Level 2 (Revision 1)
CSS Level 2 (Revision 1) {{ Spec2('CSS2.1') }} Explicitly defined
CSS Level 1 {{ Spec2('CSS1') }} Implicitly defined

Browser Compatibility

{{ CompatibilityTable() }}

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
basic 1.0 1.0 (1.0) <=5.0 yes 1.0 (85)
Feature Android Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile
Basic support yes yes yes yes yes

See also

Revision Source

<p>{{ CSSRef() }}</p>
<h2 name="Summary">Summary</h2>
<p>The <code>&lt;integer&gt;</code> <a href="/en/CSS" title="CSS">CSS</a> data type represent an integer number, positive or negative. There isn't any associated unit with the value. An integer consists of one or several decimal digit, 0 to 9, eventually preceded by one single + or - sign.</p>
<p>Integers are used e.g. in CSS {{ Xref_csscolorvalue() }} values and in these CSS properties:<br> {{ cssxref("z-index") }}, {{ cssxref("line-height") }}, {{ cssxref("counter-increment") }}, {{ Cssxref("-moz-column-count") }}.</p>
<h2>Examples</h2>
<p>These are valid integer values:</p>
<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 - (Though strange, this is an allowed value)
</pre>
<p>These are invalid integer values:</p>
<pre>12.0        This is a <a href="mks://localhost/en/CSS/number" title="en/CSS/number">&lt;number&gt;</a>, though it represents an integer
12.         The dot should not be part of an &lt;integer&gt;
+---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 escaped (here: the Japanese 5, 四)
</pre>
<p>{{ languages( { "es": "es/CSS/integer", "ja": "ja/CSS/integer" } ) }}</p><h2 name="Specifications">Specifications</h2>
<table border="1" cellpadding="1" cellspacing="1" style="width: 1053px; border-style: solid; border-width: 1px; height: 75px; border-color: rgb(0,0,0);"> <thead> <tr style="background-color: rgb(255, 204, 255);"> <th scope="col">Specification</th> <th scope="col">Status</th> <th scope="col">Comment</th> </tr> </thead> <tbody> <tr> <td><a class="external" href="http://www.w3.org/TR/css3-values/#integers" title="http://www.w3.org/TR/css3-values/#integers">CSS Values and Units Level 3</a></td> <td>{{ Spec2('CSS3 Values') }}</td> <td>No significant change from CSS Level 2 (Revision 1)</td> </tr> <tr style="vertical-align: top;"> <td style="vertical-align: top;"><a class="external" href="http://www.w3.org/TR/CSS21/syndata.html#numbers" title="http://www.w3.org/TR/CSS21/syndata.html#numbers">CSS Level 2 (Revision 1)</a></td> <td style="vertical-align: top;">{{ Spec2('CSS2.1') }}</td> <td style="vertical-align: top;">Explicitly defined</td> </tr> <tr> <td style="vertical-align: top;"><a class="external" href="http://www.w3.org/TR/CSS1/" title="http://www.w3.org/TR/CSS1/">CSS Level 1</a></td> <td style="vertical-align: top;">{{ Spec2('CSS1') }}</td> <td style="vertical-align: top;">Implicitly defined</td> </tr> </tbody>
</table>
<h2 name="Browser_Compatibility">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</td> <td>1.0</td> <td>1.0 (1.0)</td> <td>&lt;=5.0</td> <td>yes</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>yes</td> <td>yes</td> <td>yes</td> <td>yes</td> <td>yes</td> </tr> </tbody> </table>
</div>
<h2>See also</h2>
<ul> <li><a href="/en/CSS_Reference" title="CSS Reference">CSS Reference</a> index</li> <li>CSS Data Types : {{ CSSDataTypes() }}</li>
</ul>
Revert to this revision