<frequency> CSS数据类型表示频率维度,像一个说话声音的音调。 它由一个位<number> 紧接着是单位组成。像任何CSS维度一样,单位字面和数字之间没有空格。


  • Hz 表示以赫兹为单位的频率。例如: 0Hz, 1500Hz, 10000Hz.
  • kHz 表示以千赫为单位的频率。例如:  0kHz, 1.5kHz, 10kHz.

Even if all units represent the same time for the value 0, the unit may not be omitted in that case as it isn't a length: 0 is invalid and does not represent 0Hz, 0kHz. Though the units are case-insensitive in CSS, it is good practice to use a capital H for Hz and kHz, as in the SI, Hertz being a family noun.


Code Meaning
12Hz Positive integer.
-456kHz Negative integer.
4.3Hz Non-integer.
14KhZ The unit is case-insensitive, though non-SI capitalization is not recommended.
+0Hz Zero, with a leading + and the unit.
-0kHz Zero, with a leading - and the unit (Though strange, this is an allowed value).
Code Meaning
12.0 This is a <number>, not an <frequency>, it must have a unit.
7 Hz No space is allowed between the <number> and the unit.
0 Zero values can be written without a unit only if there are <length> values, not <frequency>.


Specification Status Comment
CSS Values and Units Module Level 3
Candidate Recommendation Initial definition

This data type was initially introduced in CSS Level 2 for the now obsoleted aural media group, where it was used to define the pitch of the voice. This has been deprecated since then, but the <frequency> data type has been reintroduced in CSS3, though no CSS property is using it at the moment.


Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support 未实现 未实现 未实现 未实现[1] 未实现
Feature Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support 未实现 未实现 未实现 未实现 未实现

[1] Some versions of Opera may have (partial) support for the obsolete aural media group, and through the pitch property support for the <frequency> data type.


 此页面的贡献者: xgqfrms-GitHub
 最后编辑者: xgqfrms-GitHub,