<integer>
<integer> CSS 数据类型是一种特殊的 <number> 类型,它表示一个正或负的整数。整数可以用于许多 CSS 属性和描述符,例如 column-count、counter-increment、grid-column、grid-row 和 z-index 属性以及 range 描述符。
语法
<integer> 数据类型由一个或多个十进制数字(0 到 9,包括 0 和 9)组成,前面可选带一个 + 或 - 号。整数没有关联的单位。
注意: <integer> 值没有官方的有效范围,规范也没有指定范围。
插值
在动画中,<integer> 数据类型的值使用离散的整步进行插值。计算过程如同它们是实数、浮点数一样;离散值通过向下取整函数获得。插值的速度由与动画关联的缓动函数决定。
示例
有效整数
12 Positive integer (without a leading + sign) +123 Positive integer (with a leading + sign) -456 Negative integer 0 Zero +0 Zero, with a leading + -0 Zero, with a leading -
无效整数
12.0 This is a <number>, not an <integer>, though it represents an integer. 12. Decimal points are not allowed. +---12 Only one leading +/- is allowed. ten Letters are not allowed. _5 Special characters are not allowed. \35 Escaped Unicode characters are not allowed, even if they are an integer (here: 5). \4E94 Non-arabic numerals are not allowed, even when escaped (here: the Japanese 5, 五). 3e4 Scientific notation is not allowed.
规范
| 规范 |
|---|
| CSS 值和单位模块第 4 级 # 整数 |
浏览器兼容性
加载中…