Table of contents
- 1. Summary
- 2. Interpolation
- 3. Examples
- 4. Specifications
- 5. Browser Compatibility
- 6. See also
« CSS « CSS Reference
Summary
The <integer>
CSS data type denotes 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 in numerous CSS properties, e. g. z-index
, line-height
, counter-increment
, column-count
.
Also any <integer>
CSS value is also a <number>
CSS value, though the converse is not true.
<integer>
values, but the specification requests that integer values in the range [-224-1; 224-1] must be supported. [1]Interpolation
Values of the <integer>
CSS data type can be interpolated in order to allow animations. In that case they are interpolated via integer discrete steps. The calculation is done as if they were real, floating-point, numbers and the discrete value is obtained using the floor function. [2] The speed of the interpolation is determined by the timing function associated with the animation.
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>, not an <integer>, 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, 四)
Specifications
Specification | Status | Comment |
---|---|---|
CSS Values and Units Level 3 | Working Draft | No significant change from CSS Level 2 (Revision 1) |
CSS Level 2 (Revision 1) | Recommendation | Explicitly defined |
CSS Level 1 | Recommendation | Implicitly defined |
Browser Compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
---|---|---|---|---|---|
basic | 1.0 | 1.0 (1.0) | 3.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
- CSS Reference index
- CSS Data Types :
<angle>
,<color>
,<frequency>
,<gradient>
,<identifier>
,<image>
,<integer>
,<length>
,<number>
,<percentage>
,<ratio>
,<resolution>
,<shape>
,<string>
,<time>
,<timing-function>
,<uri>