aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/css/frequency/index.html
blob: f230c49052bde0a7a684874829e6d7baeb5b3b64 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
---
title: <frequency>
slug: Web/CSS/frequency
tags:
  - CSS
  - Web
  - 参考
translation_of: Web/CSS/frequency
---
<div>{{CSSRef}}</div>

<p><span><code>&lt;frequency&gt;</code> <a href="/en-US/docs/Web/CSS">CSS</a></span>数据类型表示频率维度,例如语音的音高。目前它未在任何 CSS 属性中被使用。</p>

<h2 id="语法">语法</h2>

<p>The <code>&lt;frequency&gt;</code> data type consists of a {{cssxref("&lt;number&gt;")}} followed by one of the units listed below. As with all CSS dimensions, there is no space between the unit literal and the number.</p>

<h3 id="单位">单位</h3>

<p>可以使用以下单位:</p>

<dl>
 <dt><code><a id="Hz" name="Hz">Hz</a></code></dt>
 <dd>表示以赫兹(hertz)为单位的频率。例如:<code>0Hz</code><code>1500Hz</code><code>10000Hz</code></dd>
 <dt><code><a id="kHz" name="kHz">kHz</a></code></dt>
 <dd>表示以千赫兹(kilohertz)为单位的频率。例如:<code>0kHz</code><code>1.5kHz</code><code>10kHz</code></dd>
</dl>

<div class="note">
<p><strong>Note:</strong> Although the number <code>0</code> is always the same regardless of unit, the unit may not be omitted. In other words, <code>0</code> is invalid and does not represent <code>0Hz</code> or <code>0kHz</code>. Though the units are case-insensitive, it is good practice to use a capital "H" for <code>Hz</code> and <code>kHz</code>, as specified in the <a class="external" href="https://en.wikipedia.org/wiki/International_System_of_Units">SI</a>.</p>
</div>

<h2 id="示例">示例</h2>

<pre>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</pre>

<h3 id="Invalid_frequency_values">Invalid frequency values</h3>

<pre class="example-bad">12.0     This is a &lt;number&gt;, not an &lt;frequency&gt;, 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 &lt;length&gt;, it's an invalid &lt;frequency&gt;.</pre>

<h2 id="规范">规范</h2>

<table class="standard-table">
 <thead>
  <tr>
   <th scope="col">规范</th>
   <th scope="col">状态</th>
   <th scope="col">备注</th>
  </tr>
 </thead>
 <tbody>
  <tr>
   <td>{{SpecName('CSS3 Values', '#frequency', '&lt;frequency&gt;')}}</td>
   <td>{{Spec2('CSS3 Values')}}</td>
   <td>Initial definition</td>
  </tr>
 </tbody>
</table>

<div class="note">
<p><strong>Note:</strong> This data type was initially introduced in <a class="external" href="https://www.w3.org/TR/CSS2/aural.html#q19.0" title="http://www.w3.org/TR/CSS2/">CSS Level 2</a> for the now-obsolete <a href="/en-US/docs/Web/CSS/@media/aural" title="aural">aural</a> <a href="/en-US/docs/Web/CSS/@media#Media_types">media type</a>, where it was used to define the pitch of the voice. However, the <code>&lt;frequency&gt;</code> data type has been reintroduced in CSS3, though no CSS property is using it at the moment.</p>
</div>

<h2 id="浏览器兼容性">浏览器兼容性</h2>



<p>{{Compat("css.types.frequency")}}</p>