number property CSS Reference

Definition and Usage

The <number> CSS data type represents a number, either integer or fractional. Its syntax extends the one of the <integer> data value. To represent a fractional value, add the fractional part — a '.' followed by one or several decimal digits — to any <integer> data value. Like for <integer> data type, there isn't any unit associated to a <number>, which is not a CSS dimension.


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


These are valid number values:

12          A raw <integer> is also a <number>
4.01        A positive non-integer <number>
-456.8      Negative non-integer <number>
0.0         Zero
+0.0        Zero, with a leading +
-0.0        Zero, with a leading - (Though strange, this is an allowed value)
.60         Digits are optional before the dot

These are invalid number values:

12.         The dot should be followed by a number
+---12.2    Only one leading +/- is allowed
12.1.1      Only one dot is allowed
10e3        The e notation is not allowed


Desktop browsers

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
basic 1.0 1.0 (1.0) <=5.0 yes 1.0 (85)

Mobile browsers

Feature Android Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile
Basic support yes yes yes yes yes

Relative articles