aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/css/@font-face/font-family/index.html
blob: 3c2866177c3b7c50ca6bb39d946e5564e734dbdc (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
---
title: font-family
slug: Web/CSS/@font-face/font-family
translation_of: Web/CSS/@font-face/font-family
---
<div>{{CSSRef}}</div>

<div><strong><code>font-family</code></strong><code>属性允许我们为页面上的字体指定一个由</code>{{cssxref("@font-face")}} 规则定义的字体族</div>

<p>The <strong><code>font-family</code></strong> CSS descriptor allows authors to specify the font family for the font specified in an {{cssxref("@font-face")}} rule.</p>

<p>{{cssinfo}}</p>

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

<pre class="brush: css">/* &lt;string&gt; values */
font-family: "font family";
font-family: 'another font family';

/* &lt;IDENT&gt; value */
font-family: examplefont;
</pre>

<h3 id="取值">取值</h3>

<dl>
 <dt><code>&lt;family-name&gt;</code></dt>
 <dd>指定字体族名称</dd>
</dl>

<h3 id="Formal_syntax">Formal syntax</h3>

{{csssyntax}}

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

<pre class="brush: css">@font-face {
  font-family: examplefont;
  src: url('examplefont.ttf');
}
</pre>

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

<table class="standard-table">
 <thead>
  <tr>
   <th scope="col">Specification</th>
   <th scope="col">Status</th>
   <th scope="col">Comment</th>
  </tr>
 </thead>
 <tbody>
  <tr>
   <td>{{SpecName('CSS3 Fonts', '#font-family-desc', 'font-family')}}</td>
   <td>{{Spec2('CSS3 Fonts')}}</td>
   <td>Initial definition</td>
  </tr>
 </tbody>
</table>

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

{{Compat("css.at-rules.font-face.font-family")}}