blob: 1002d02fb409a2e37e0c1388962ec1b05b865dcb (
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
|
---
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">/* <string> values */
font-family: "font family";
font-family: 'another font family';
/* <IDENT> value */
font-family: examplefont;
</pre>
<h3 id="取值">取值</h3>
<dl>
<dt><code><family-name></code></dt>
<dd>指定字体族名称</dd>
</dl>
<h3 id="Formal_syntax">Formal syntax</h3>
<pre class="syntaxbox">{{csssyntax}}</pre>
<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>
<p>{{CompatibilityTable}}</p>
<div id="compat-desktop">
<table class="compat-table">
<tbody>
<tr>
<th>Feature</th>
<th>Chrome</th>
<th>Edge</th>
<th>Firefox (Gecko)</th>
<th>Internet Explorer</th>
<th>Opera</th>
<th>Safari</th>
</tr>
<tr>
<td>Basic support</td>
<td>{{CompatChrome("4")}}</td>
<td>12.0</td>
<td>{{CompatGeckoDesktop("1.9.1")}}</td>
<td>{{CompatIE("6.0")}}</td>
<td>{{CompatOpera("9.0")}}</td>
<td>{{CompatSafari("3.1")}}</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 Mini</th>
<th>Opera Mobile</th>
<th>Safari Mobile</th>
</tr>
<tr>
<td>Basic support</td>
<td>{{CompatAndroid("2.2")}}</td>
<td>{{CompatGeckoMobile("1.9.1")}}</td>
<td>{{CompatIE("10.0")}}</td>
<td>{{CompatNo}}</td>
<td>{{CompatOpera("12.0")}}</td>
<td>{{CompatSafari("3.1")}}</td>
</tr>
</tbody>
</table>
</div>
|