The <number>
CSS data type represents a number, being either an integer or a number with a fractional component.
Syntax
The syntax of <number>
extends the syntax of <integer>
. A fractional value is represented by a .
followed by one or more decimal digits, and may be appended to an integer. There is no unit associated with numbers.
Interpolation
When animated, values of the <number>
CSS data type are interpolated as real, floating-point numbers. The speed of the interpolation is determined by the timing function associated with the animation.
Examples
Valid numbers
12 A raw <integer> is also a <number>. 4.01 Positive fraction -456.8 Negative fraction 0.0 Zero +0.0 Zero, with a leading + -0.0 Zero, with a leading - .60 Fractional number without a leading zero 10e3 Scientific notation -3.4e-2 Complicated scientific notation
Invalid numbers
12. Decimal points must be followed by at least one digit. +-12.2 Only one leading +/- is allowed. 12.1.1 Only one decimal point is allowed.
Specifications
Specification | Status | Comment |
---|---|---|
CSS Values and Units Module Level 4The definition of '<number>' in that specification. | Editor's Draft | No significant change. |
CSS Values and Units Module Level 3The definition of '<number>' in that specification. | Candidate Recommendation | No significant change. |
CSS Level 2 (Revision 1)The definition of '<number>' in that specification. | Recommendation | Explicit definition. |
CSS Level 1The definition of '<number>' in that specification. | Recommendation | Implicit definition. |
Browser compatibility
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Update compatibility data on GitHub
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
<number> | Chrome
Full support 1 |
Edge
Full support 12 |
Firefox
Full support 1 |
IE
Full support 5 |
Opera
Full support 2 |
Safari
Full support 1 |
WebView Android
Full support 1 |
Chrome Android
Full support 18 |
Firefox Android
Full support 4 |
Opera Android
Full support 10.1 |
Safari iOS
Full support 1 |
Samsung Internet Android
Full support 1.0 |
Scientific notation | Chrome
Full support 43 |
Edge
Full support 12 |
Firefox
Full support 29 |
IE
Full support 11 |
Opera
Full support 30 |
Safari
Full support 10.1 |
WebView Android
Full support 43 |
Chrome Android
Full support 43 |
Firefox Android
Full support 29 |
Opera Android
Full support 30 |
Safari iOS
Full support 10.3 |
Samsung Internet Android
Full support 4.0 |
Legend
- Full support
- Full support
See also
<number> by Mozilla Contributors is licensed under CC-BY-SA 2.5.