-
Notifications
You must be signed in to change notification settings - Fork 22.4k
/
index.md
54 lines (37 loc) · 1.48 KB
/
index.md
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
---
title: <number>
slug: Web/CSS/number
page-type: css-type
browser-compat: css.types.number
---
{{CSSRef}}
The **`<number>`** [CSS](/en-US/docs/Web/CSS) [data type](/en-US/docs/Web/CSS/CSS_Types) represents a number, being either an integer or a number with a fractional component.
## Syntax
The syntax of `<number>` extends the syntax of {{CSSxRef("<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 [easing function](/en-US/docs/Web/CSS/easing-function) associated with the animation.
## Examples
### Valid numbers
```plain example-good
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
```plain example-bad
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
{{Specifications}}
## Browser compatibility
{{Compat}}
## See also
- {{CSSxRef("<integer>")}}