<frequency>

Summary

The <frequency> CSS data type denotes a frequency dimension, like the pitch of a speaking voice. It consists of a <number> immediately followed by the unit. Like for any CSS dimension, there is no space between the unit literal and the number.

The following units may be used:

  • Hz which represents a frequency in Hertz. E.g. 0Hz, 1500Hz, 10000Hz.
  • kHz which represents a frequency in kilohertz. E.g. 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.

Examples

Valid frequency values
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
Invalid frequency values
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>.

Specifications

Specification Status Comment
CSS Values and Units Module Level 3
The definition of '<frequency>' in that specification.
Candidate Recommendation  

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.

Browser compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support No support No support No support No support [*] No support
Feature Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support No support No support No support No support No support

[*] 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.

Document Tags and Contributors

 Contributors to this page: jswisher, moali1., Prinz_Rana, Tigt, fscholz, teoli, kscarfone, FredB, Sheppy, McGurk
 Last updated by: jswisher,