font-style
CSS descriptor allows authors to specify font styles for the fonts specified in the
@font-face
rule.
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
font-style
descriptor to explicitly specify the font face's style. The values for the CSS descriptor is same as that of its corresponding font property.
font-style: normal; font-style: italic; font-style: oblique; font-style: oblique 30deg; font-style: oblique 30deg 50deg;
normal
Selects the normal version of the font-family.
italic
Specifies that font-face is an italicized version of the normal font.
oblique
Specifies that the font-face is an artificially sloped version of the normal font.
oblique
with angle
oblique
, and additionally specifies an angle for the slant of the text.
oblique
with angle range
oblique
, and additionally specifies a range of allowable angle for the slant of the text. Note that a range is only supported when the
font-style
is
oblique
; for
font-style: normal
or
italic
, no second value is allowed.
| 相关 at-rule |
@font-face
|
|---|---|
| 初始值 |
normal
|
| 计算值 | 如指定 |
normal | italic | oblique <angle>{0,2}
As an example, consider the garamond font family, in its normal form, we get the following result:
@font-face {
font-family: garamond;
src: url('garamond.ttf');
}
The italicized version of this text uses the same glyphs present in the unstyled version, but they are artificially sloped by a few degrees.
On the other hand, if a true italicized version of the font family exists, we can include it in the
src
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
not
artificially sloped.
@font-face {
font-family: garamond;
src: url('garamond-italic.ttf');
font-style: italic;
}
| 规范 | 状态 | 注释 |
|---|---|---|
|
CSS Fonts Module Level 4
The definition of 'font-style' in that specification. |
工作草案 | Adds oblique keyword with angle value |
|
CSS Fonts Module Level 3
The definition of 'font-style' in that specification. |
候选推荐 | 初始定义 |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
font-style
|
Chrome 完整支持 4 | Edge 完整支持 12 | Firefox 完整支持 3.5 | IE 完整支持 4 | Opera 完整支持 10 | Safari 完整支持 3.1 | WebView Android 完整支持 ≤37 | Chrome Android 完整支持 18 | Firefox Android 完整支持 4 | Opera Android 完整支持 10.1 | Safari iOS 完整支持 2 | Samsung Internet Android 完整支持 1.0 |
完整支持
font-display
font-family
font-stretch
font-weight
font-variant
font-feature-settings
font-variation-settings
src
unicode-range
font
font-family
font-feature-settings
font-kerning
font-language-override
font-optical-sizing
font-size
font-size-adjust
font-smooth
font-stretch
font-style
font-synthesis
font-variant
font-variant-alternates
font-variant-caps
font-variant-east-asian
font-variant-ligatures
font-variant-numeric
font-variant-position
font-variation-settings
font-weight
line-height
line-height-step