blob: 660323dade23a9573def9e7e41df2d9e8e592800 (
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
|
---
title: font-style
slug: Web/CSS/@font-face/font-style
translation_of: Web/CSS/@font-face/font-style
---
<p>{{CSSRef}}</p>
<h2 id="概述">概述</h2>
<p><strong>font-style</strong> 描述符允许开发者在@font-rule规则中为指定字体样式(该条目区别于font-style,意指用在@font-rule中的font-style属性)</p>
<p>For a particular font family, authors can download various font faces which correspond to the different styles of the same font family, and then use the <code>font-style </code>descriptor to explicitly specify the font face's style. The values for the CSS descriptor is same as that of its corresponding font property.</p>
<p>{{cssinfo}}</p>
<h2 id="Syntax">Syntax</h2>
<div class="syntaxbox">
<pre class="brush: css">font-style: normal;
font-style: italic;
font-style: oblique;</pre>
<h3 id="Values">Values</h3>
<p><code><strong>normal</strong></code><br>
Selects the normal version of the font-family.</p>
<p><strong><code>italic</code></strong><br>
Specifies that font-face is an italicized version of the normal font .</p>
<p><strong><code>oblique</code></strong><br>
Specifies that the font-face is an artificially sloped version of the normal font.</p>
<h3 id="Formal_syntax">Formal syntax</h3>
{{csssyntax}}
<h2 id="Examples">Examples</h2>
<p>As an example, consider the garamond font family, in its normal form, we get the following result:</p>
<pre class="brush: css">@font-face {
font-family: garamond;
src: url('garamond.ttf');
}</pre>
<p><img alt="unstyled Garamond" src="https://mdn.mozillademos.org/files/12265/garamondunstyled.JPG" style="height: 101px; width: 276px;"></p>
<p>The italicized version of this text uses the same glyphs present in the unstyled version, but they are artificially sloped by a few degrees.</p>
<p><img alt="artificially sloped garamond" src="https://mdn.mozillademos.org/files/12267/garamondartificialstyle.JPG" style="height: 101px; width: 276px;"></p>
<p>On the other hand, if a true italicized version of the font family exists, we can include it in the <code>src </code>descriptor and specify the font style as italic, so that it is clear that the font is italicized. True italics use different glyphs and are a bit different from their upright counterparts, having some unique features and generally have a rounded and calligraphic quality. These fonts are specially created by font designers and are <strong>not</strong> artificially sloped.</p>
<pre class="brush: css">@font-face {
font-family: garamond;
src: url('garamond-italic.ttf');
font-style: italic;
}</pre>
<p><img alt="italic garamond" src="https://mdn.mozillademos.org/files/12269/garamonditalic.JPG" style="height: 101px; width: 267px;"></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', '#descdef-font-face-unicode-range', 'unicode-range')}}</td>
<td>{{Spec2('CSS3 Fonts')}}</td>
<td>Initial definition</td>
</tr>
</tbody>
</table>
<h2 id="Browser_compatibility">Browser compatibility</h2>
{{Compat("css.at-rules.font-face.font-style")}}
|