frequency

  • Revision slug: CSS/frequency
  • Revision title: frequency
  • Revision id: 56275
  • Created:
  • Creator: teoli
  • Is current revision? No
  • Comment one or more formatting changes

Revision Content

{{ CSSRef() }}

Summary

The <frequency> CSS data types denotes a frequency dimension, like the pitch of a speaking voice. They consists of a {{ Xref_cssnumber() }} 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 time in kilohertz. E.g. 0kHz, 1.5kHz, 10kHz.

As all units represents the same time for the value 0, the unit may be omitted in that case: 0 represents 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 time values:

12Hz        Positive integer
-456kHz     Negative integer
4.3Hz       Non-integer
14KhZ       The unit is case-insensitive, though non-SI capitalization is not recommended.
0           Zero (without the unit)
+0s         Zero, with a leading + and the unit
-0ms        Zero, with a leading - and the unt(Though strange, this is an allowed value)

These are invalid time 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

Specifications

Specification Status Comment
CSS Values and Units Level 3 {{ Spec2('CSS3 Values') }}  

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

{{ CompatibilityTable() }}

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

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

See also

Revision Source

<p>{{ CSSRef() }}</p>
<h2>Summary</h2>
<p>The <code>&lt;frequency&gt;</code> <a href="/en/CSS" title="CSS">CSS</a> data types denotes a frequency dimension, like the pitch of a speaking voice. They consists of a <span class="lang lang-en">{{ Xref_cssnumber() }}</span> immediately followed by the unit. Like for any CSS dimension, there is no space between the unit literal and the number.</p>
<p>The following units may be used :</p>
<ul> <li><code>Hz</code> which represents a frequency in Hertz. E.g. <code>0Hz</code>, <code>1500Hz</code>, <code>10000Hz</code>.</li> <li><code>kHz</code> which represents a time in kilohertz. E.g. <code>0kHz</code>, <code>1.5kHz</code>, <code>10kHz</code>.</li>
</ul>
<p>As all units represents the same time for the value 0, the unit may be omitted in that case: <code>0</code> represents <code>0Hz</code>, <code>0kHz</code>. Though the units are case-insensitive in CSS, it is good practice to use a capital H for <code>Hz</code> and <code>kHz</code>, as in the <a class="external" href="http://en.wikipedia.org/wiki/International_System_of_Units" title="http://en.wikipedia.org/wiki/International_System_of_Units">SI</a>, <a class="external" href="http://en.wikipedia.org/wiki/Heinrich_Hertz" title="http://en.wikipedia.org/wiki/Heinrich_Hertz">Hertz</a> being a family noun.</p>
<h2 class="editable"><span>Examples</span></h2>
<p>These are valid time values:</p>
<pre>12Hz        Positive integer
-456kHz     Negative integer
4.3Hz       Non-integer
14KhZ       The unit is case-insensitive, though non-SI capitalization is not recommended.
0           Zero (without the unit)
+0s         Zero, with a leading + and the unit
-0ms        Zero, with a leading - and the unt(Though strange, this is an allowed value)
</pre>
<p>These are invalid time values:</p>
<pre>12.0        This is a <a href="mks://localhost/en/CSS/number" title="en/CSS/number">&lt;number&gt;</a>, not an &lt;frequency&gt;, it must have a unit
7 Hz        No space is allowed between the <a href="mks://localhost/en/CSS/number" title="en/CSS/number">&lt;number&gt;</a> and the unit
</pre>
<h2 name="Specifications">Specifications</h2>
<table class="standard-table"> <thead> <tr style="background-color: rgb(255, 204, 255);"> <th scope="col">Specification</th> <th scope="col">Status</th> <th scope="col">Comment</th> </tr> </thead> <tbody> <tr> <td><a class="external" href="http://www.w3.org/TR/css3-values/#frequencies-the-ltfrequencygt-type-and-h" title="http://www.w3.org/TR/css3-values/#frequencies-the-ltfrequencygt-type-and-h">CSS Values and Units Level 3</a></td> <td>{{ Spec2('CSS3 Values') }}</td> <td> </td> </tr> </tbody>
</table>
<p>This data type was initially introduced in <a class="external" href="http://www.w3.org/TR/CSS2/" title="http://www.w3.org/TR/CSS2/">CSS Level 2</a> for the now obsoleted <a href="/en/CSS/Aural" title="aural">aural</a> <a href="/en/CSS/@media#Media_groups" title="https://developer.mozilla.org/en/CSS/@media#Media_groups">media group</a>, where it was used to define the pitch of the voice. This has been deprecated since then, but the &lt;frequency&gt; data type has been reintroduced in CSS3, though no CSS property is using it at the moment.</p><h2>Browser compatibility</h2>
<p>{{ CompatibilityTable() }}</p>
<div id="compat-desktop"> <table class="compat-table"> <tbody> <tr> <th>Feature</th> <th>Chrome</th> <th>Firefox (Gecko)</th> <th>Internet Explorer</th> <th>Opera</th> <th>Safari</th> </tr> <tr> <td>Basic support</td> <td>no</td> <td>no</td> <td>no <a class="external" href="http://msdn.microsoft.com/en-us/library/cc351024%28v=vs.85%29.aspx#values" title="http://msdn.microsoft.com/en-us/library/cc351024%28v=vs.85%29.aspx#values"></a></td> <td>no [*]</td> <td>no</td> </tr> </tbody> </table>
</div>
<div id="compat-mobile"> <table class="compat-table"> <tbody> <tr> <th>Feature</th> <th>Android</th> <th>Firefox Mobile (Gecko)</th> <th>IE Mobile</th> <th>Opera Mobile</th> <th>Safari Mobile</th> </tr> <tr> <td>Basic support</td> <td>no</td> <td>no</td> <td>no</td> <td>no</td> <td>no</td> </tr> </tbody> </table>
</div>
<p>[*] Some versions of Opera may have (partial) support for the obsolete aural media group, and through the pitch property support for the <code>&lt;frequency&gt;</code> data type.</p><h2>See also</h2>
<ul> <li><a href="/en/CSS_Reference" title="CSS Reference">CSS Reference</a> index</li> <li>CSS Data Types : {{ CSSDataTypes() }}</li>
</ul>
Revert to this revision