<number>
CSS
data type
represents a number, being either an integer or a number with a fractional component.
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.
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.
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
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.
| 规范 | 状态 | 注释 |
|---|---|---|
|
CSS Values and Units Module Level 4
The definition of '<number>' in that specification. |
编者草案 | No significant change. |
|
CSS Values and Units Module Level 3
The definition of '<number>' in that specification. |
候选推荐 | No significant change. |
|
CSS Level 2 (Revision 1)
The definition of '<number>' in that specification. |
推荐 | Explicit definition. |
|
CSS Level 1
The definition of '<number>' in that specification. |
推荐 | Implicit definition. |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| <number> | Chrome 完整支持 1 | Edge 完整支持 12 | Firefox 完整支持 1 | IE 完整支持 5 | Opera 完整支持 2 | Safari 完整支持 1 | WebView Android 完整支持 1 | Chrome Android 完整支持 18 | Firefox Android 完整支持 4 | Opera Android 完整支持 10.1 | Safari iOS 完整支持 1 | Samsung Internet Android 完整支持 1.0 |
| Scientific notation | Chrome 完整支持 43 | Edge 完整支持 12 | Firefox 完整支持 29 | IE 完整支持 11 | Opera 完整支持 30 | Safari 完整支持 10.1 | WebView Android 完整支持 43 | Chrome Android 完整支持 43 | Firefox Android 完整支持 29 | Opera Android 完整支持 30 | Safari iOS 完整支持 10.3 | Samsung Internet Android 完整支持 4.0 |
完整支持
<angle-percentage>
<angle>
<basic-shape>
<blend-mode>
<custom-ident>
<dimension>
<frequency-percentage>
<frequency>
<gradient>
<image>
<integer>
<length-percentage>
<length>
<number>
<percentage>
<ratio>
<resolution>
<shape>
<string>
<time-percentage>
<time>
<transform-function>
<url>
color
flex
ident
position