<number>

The <number> CSS data type represents a number, being either a whole integer or a fraction.

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. Like integers, numbers are not CSS dimensions and have no unit.

Interpolation

Values of the <number> CSS data type can be interpolated in animations. They are interpolated as real, floating-point numbers. The speed of the interpolation is determined by the timing function associated with the animation.

Examples

Valid number values

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 number values

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 3
The 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 1
The definition of '<number>' in that specification.
Recommendation Implicit definition.

Browser compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support 1.0 1.0 (1.0) 5.0 (Yes) 1.0 (85)
Scientific notation 43.0 29 11 ? ?

Document Tags and Contributors

 Last updated by: mfluehr,