Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

The CSS data type represents a number, being either an integer or a number with a fractional component.

Syntax

The syntax of extends the syntax of . 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 CSS data type are interpolated as real, floating-point numbers. The speed of the interpolation is determined by the easing function associated with the animation.

Examples

Valid numbers

12          A raw  is also a .
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
CSS Values and Units Module Level 4
# numbers

Browser compatibility

See also