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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
|
---
title: font-family
slug: Web/CSS/font-family
tags:
- CSS
- Fontes CSS
- Lay
- Propriedade CSS
- Refer
- Web
translation_of: Web/CSS/font-family
---
<p>{{CSSRef}}</p>
<h2 id="Resumo">Resumo</h2>
<p>A propriedade <code>font-family do</code> CSS permite que se faça uma lista de prioridades de familias de fontes e/ou nomes genéricos de famílias a serem especificados para um elemento selecionado. Ao contrário da maioria das demais propriedades CSS, os valores são separados por vírgula para indicar quais são as alternativas. O Browser irá utilizar a primeira fonte da lista que for encontrada no computador, ou poderá fazer o dowload utilizando a informação contida na regra {{cssxref("@font-face")}}.</p>
<p>Programadores WEB devem sempre adicionar pelo menos uma família genérica para a lista de <span style="font-family: consolas,monaco,andale mono,monospace;">font-family, </span>já que não há garantia que aquela fonte específica está instalada no computador, ou possa ser baixada pela regra {{cssxref("@font-face")}}. A família genérica permite o browser selecionar uma fonte aceita pelo computador, quando necessário.</p>
<p>É também conveniente usar de antemão a propriedade {{cssxref("font")}} para definir a <code>font-size</code> e outras propriedades relacionadas a fonte todas de uma só vez.</p>
<div class="note"><strong>Nota:</strong> A propriedade <code>font-family</code> especifica a lista de fontes, da prioridade mais alta para a mais baixa.
<pre dir="ltr" id="tw-target-text">A seleção de fontes não para simplesmente na primeira fonte nomeada na lista que está no sistema do usuário. Em vez disso, a seleção de fontes é feita um caractere de cada vez, para que, se uma fonte disponível não tiver um glifo que possa exibir um caracter necessário, as fontes disponíveis mais tarde sejam tentadas. No entanto, isso não funciona no Internet Explorer 6 ou anterior.
Quando uma fonte está disponível apenas em alguns estilos, variantes ou tamanhos, essas propriedades também podem influenciar qual família de fontes é escolhida.</pre>
</div>
<p>{{cssinfo}}</p>
<h2 id="Syntax">Syntax</h2>
<pre class="twopartsyntaxbox"><a href="/en-US/docs/CSS/Value_definition_syntax" title="CSS/Value_definition_syntax">Formal syntax</a>: {{csssyntax("font-family")}}
</pre>
<pre>font-family: Gill Sans Extrabold, sans-serif
font-family: "Goudy Bookletter 1911", sans-serif
font-family: sans-serif
font-family: serif
font-family: fantasy
font-family: cursive
font-family: monospace
font-family: inherit
</pre>
<h3 id="Valores">Valores</h3>
<table class="standard-table">
<tbody>
<tr>
<td><code><family-name></code></td>
<td>O nome de uma fonte. Por exemplo, "Times" e "Helvetica" são font families. Nomes de fonte-família contém espaços em branco para serem citados..</td>
</tr>
<tr>
<td><code><generic-name></code></td>
<td>
<p>Generic font families are a fallback mechanism, a means of preserving some of the style sheet author's intent in case when none of the specified fonts are available. Generic family names are keywords and must not be quoted. A generic font family should be the a last alternative in the list of font family names.</p>
<dl>
<dt><code>serif</code></dt>
<dd style='font-family: Palatino,"Palatino Linotype",Palladio,"URW Palladio",serif;'>Glyphs have finishing strokes, flared or tapering ends, or have actual serifed endings.<br>
E.g. Palatino, "Palatino Linotype", Palladio, "URW Palladio", serif</dd>
<dt><code>sans-serif</code></dt>
<dd style='font-family: "Trebuchet MS","Liberation Sans","Nimbus Sans L",sans-serif;'>Glyphs have stroke endings that are plain.<br>
E.g. 'Trebuchet MS', 'Liberation Sans', 'Nimbus Sans L', sans-serif</dd>
<dt><code>monospace</code></dt>
<dd style='font-family: "DejaVu Sans Mono", Menlo, Consolas, "Liberation Mono", Monaco, "Lucida Console", monospace;'>All glyphs have the same fixed width.<br>
E.g. "DejaVu Sans Mono", Menlo, Consolas, "Liberation Mono", Monaco, "Lucida Console", monospace</dd>
<dt><code>cursive</code></dt>
<dd>Glyphs in cursive fonts generally have either joining strokes or other cursive characteristics beyond those of italic typefaces. The glyphs are partially or completely connected, and the result looks more like handwritten pen or brush writing than printed letterwork.</dd>
<dt><code>fantasy</code></dt>
<dd>Fantasy fonts are primarily decorative fonts that contain playful representations of characters.</dd>
</dl>
</td>
</tr>
</tbody>
</table>
<h3 id="Valid_family_names">Valid family names</h3>
<p>Font family names must either be given quoted as strings, or unquoted as a sequence of one or more identifiers. This means that punctuation characters and digits at the start of each token must be escaped in unquoted font family names.</p>
<p>For example, the following declarations are valid:</p>
<pre>font-family: Gill Sans Extrabold, sans-serif;
font-family: "Goudy Bookletter 1911", sans-serif;</pre>
<p>The following declarations are <strong>invalid</strong>:</p>
<pre>font-family: Goudy Bookletter 1911, sans-serif;
font-family: Red/Black, sans-serif;
font-family: "Lucida" Grande, sans-serif;
font-family: Ahem!, sans-serif;
font-family: test@foo, sans-serif;
font-family: #POUND, sans-serif;
font-family: Hawaii 5-0, sans-serif;</pre>
<h2 id="Examples">Examples</h2>
<h3 id="Example_1">Example 1</h3>
<pre class="brush: css">body {
font-family: "Gill Sans Extrabold", Helvetica, sans-serif;
}
.receipt {
font-family: Courier, "Lucida Console", monospace;
}
</pre>
<h3 id="Example_2">Example 2</h3>
<pre class="brush: css">.exampleserif {
font-family: Times, "Times New Roman", Georgia, serif;
}
.examplesansserif {
font-family: Verdana, Arial, Helvetica, sans-serif;
}
.examplemonospace {
font-family: "Lucida Console", Courier, monospace;
}
.examplecursive {
font-family: cursive;
}
.examplefantasy {
font-family: fantasy;
}
</pre>
<pre class="brush: html"><div class="exampleserif">
This is an example of a serif font.
</div>
<div class="examplesansserif">
This is an example of a sans-serif font.
</div>
<div class="examplemonospace">
This is an example of a monospace font.
</div>
<div class="examplecursive">
This is an example of a cursive font.
</div>
<div class="examplefantasy">
This is an example of a fantasy font.
</div></pre>
<h4 id="Live_Sample">Live Sample</h4>
<p>{{ EmbedLiveSample('Example_2','600','120') }}</p>
<h2 id="Specifications">Specifications</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-prop', 'font-family')}}</td>
<td>{{Spec2('CSS3 Fonts')}}</td>
<td>No significant change</td>
</tr>
<tr>
<td>{{SpecName('CSS2.1', 'fonts.html#propdef-font-family', 'font-family')}}</td>
<td>{{Spec2('CSS2.1')}}</td>
<td>No significant change</td>
</tr>
<tr>
<td>{{SpecName('CSS1', '#font-family', 'font-familiy')}}</td>
<td>{{Spec2('CSS1')}}</td>
<td>Initial definition</td>
</tr>
</tbody>
</table>
<h2 id="Browser_compatibility" name="Browser_compatibility">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>1.0</td>
<td>{{CompatGeckoDesktop("1")}}</td>
<td>3.0</td>
<td>3.5</td>
<td>1.0</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 Phone</th>
<th>Opera Mobile</th>
<th>Safari Mobile</th>
</tr>
<tr>
<td>Basic support</td>
<td>1.0</td>
<td>{{CompatGeckoMobile("1")}}</td>
<td>6.0</td>
<td>6.0</td>
<td>1.0</td>
</tr>
</tbody>
</table>
</div>
|