frequency property CSS Reference



Definition and Usage

The <frequency> CSS data types denotes a frequency dimension, like the pitch of a speaking voice. They 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

These are valid frequency values:

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).

These are 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>.

Compatibility

Desktop browsers

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support Not supported Not supported Not supported Not supported Not supported

Mobile browsers

Feature Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support Not supported Not supported Not supported Not supported Not supported

Relative articles