CSS参考手册
值和单位 | Values & Units
数字 |
<number>
CSS数据类型代表一个数字,无论是整数或分数。
语法
<number>
的语法扩展了<integer>
的语法。小数由“ .
”后跟一个或多个十进制数字表示,并可以附加到整数上。像<integer>
一样,<number>
不是CSS尺寸(CSS dimensions),也没有单位。
线性插值
<number>
CSS数据类型的值可以在插animation
中。它们作为实浮点数被插入。内插的速度由与动画相关的timing函数决定。
实例
有效值
12 一个<integer>也是一个<number>。
4.01 正分数
-456.8 负分数
0.0 零
+0.0 零,带前导符号+
-0.0 零,带前导符号-
.60 不带前导零的小数
10e3 科学记数法
-3.4e-2 复杂的科学记数法
无效值
12. 小数点后面必须至少有一位数字。
+ -12.2 只允许一个前导+/-。
12.1.1 只允许有一个小数点。
规范
Specification |
Status |
Comment |
---|---|---|
CSS Values and Units Module Level 3The 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 1The definition of '<number>' in that specification. |
Recommendation |
Implicit definition. |
浏览器兼容性
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 |
? |
? |
Feature |
Android |
Firefox Mobile (Gecko) |
IE Phone |
Opera Mobile |
Safari Mobile |
---|---|---|---|---|---|
Basic support |
(Yes) |
(Yes) |
(Yes) |
(Yes) |
(Yes) |
Scientific notation |
(Yes) |
(Yes) |
(Yes) |
(Yes) |
(Yes) |
值和单位 | Values & Units相关
层叠样式表( Cascading Style Sheets )是一种用来表现 HTML 或 XML 等文件样式的计算机语言。CSS 不仅可以静态地修饰网页,还可以配合各种脚本语言动态地对网页各元素进行格式化。