<frequency-percentage>

<frequency-percentage> CSS 数据类型表示一个值,该值可以是 <frequency><percentage>。频率值(例如,人声的音高)目前并未在任何 CSS 属性中使用。

语法

<frequency-percentage> 的值可以是 <frequency><percentage>;有关其语法的详细信息,请参阅各自的参考页面。

描述

在 calc() 中使用

<frequency-percentage> 被指定为允许的类型时,这意味着百分比会解析为频率,因此可以在 calc() 表达式中使用。

正式语法

<frequency-percentage> = 
<frequency> |
<percentage>

示例

有效的百分比值

90% Positive percentage
+90% Positive percentage with leading +
-90% Negative percentage — not valid for all properties that use percentages

无效的百分比值

90 % No space is allowed between the number and the unit

有效的频率值

12Hz     Positive integer
4.3Hz    Non-integer
14KhZ    The unit is case-insensitive, though non-SI capitalization is not recommended.
+0Hz     Zero, with a leading + and a unit
-0kHz    Zero, with a leading - and a unit

无效的频率值

12.0     This is a <number>, not an <frequency>, because it is missing a unit.
7 Hz     No space is allowed between the number and the unit.
0        Although unitless zero is an allowable <length>, it's an invalid <frequency>.

规范

规范
CSS 值和单位模块第 4 级
# typedef-frequency-percentage

浏览器兼容性

目前没有浏览器支持此功能。

另见