The 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.
Related at-rule | @font-face |
---|---|
Initial value | normal |
Media | all |
Computed value | as specified |
Canonical order | the unique non-ambiguous order defined by the formal grammar |
font-style: normal; font-style: italic; font-style: oblique; font-style: oblique 30deg; font-style: oblique 30deg 50deg;
normal
italic
oblique
oblique
with angleoblique
, and additionally specifies an angle for the slant of the text.oblique
with angle rangeoblique
, 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.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; }
Specification | Status | Comment |
---|---|---|
CSS Fonts Module Level 4 The definition of 'font-style' in that specification. | Working Draft | Adds oblique keyword with angle value |
CSS Fonts Module Level 3 The definition of 'font-style' in that specification. | Candidate Recommendation | Initial definition |
Desktop | ||||||
---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | |
Basic support | 4 | ? | 3.5 | 4 | 10 | 3.1 |
Mobile | |||||||
---|---|---|---|---|---|---|---|
Android webview | Chrome for Android | Edge Mobile | Firefox for Android | Opera for Android | iOS Safari | Samsung Internet | |
Basic support | Yes | ? | ? | 4 | 10 | Yes | Yes |
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-style