CSS Reference ยท Typography
The font-style property
Reference for the CSS font-style property: normal, italic and oblique values, the oblique angle, how it differs from synthesized slanting, with live examples.
The font-style property chooses between the upright, italic and oblique faces of a font. Browsers use it to pick a matching face from the font family, and the default for most text is normal (upright).
An italic face is usually a separately drawn design with its own letter shapes. An oblique face is the upright design slanted. If a family has no italic, browsers fall back to an oblique face, and if there is no slanted face at all they may slant the upright glyphs themselves (see font-synthesis).
em { font-style: italic; } .slanted { font-style: oblique 12deg; }
Try it
With most installed fonts, italic and oblique look the same, because the family has only one slanted face. The angle form (oblique 25deg) lets the browser slant the glyphs by that amount, or use a variable font's slant axis when one exists.
Syntax
font-style: normal | italic | oblique <angle>?;
| Initial value | normal |
| Applies to | All elements and text |
| Inherited | Yes |
| Animatable | Yes (keywords switch at once; oblique angles interpolate) |
| Computed value | The specified keyword, with any angle |
Values
| Value | Description |
|---|---|
normal |
Selects the upright face. |
italic |
Selects the italic face. If the family has none, an oblique face is used, then a synthesized slant. |
oblique |
Selects an oblique face. Without an angle, the default slant is 14 degrees. |
oblique <angle> |
Slants by the given angle, from -90deg to 90deg. Positive angles lean to the right. |
Usage notes
- Meaning vs style. Use
<em>when you mean emphasis and<i>for alternate voice, such as a foreign phrase. Reach forfont-styleto change how they look, not to add meaning. - Reset for nested emphasis. Setting
font-style: normalon an<em>inside an italic block is the usual way to make emphasis stand out in italic text. - Angles need support. Specific angles only change the look when the font is variable with a slant axis, or when the browser synthesizes the slant. With static fonts, check what your installed faces really do.
- Web fonts. When you load fonts with
@font-face, declarefont-style: italicon the italic file, or the browser will not know it is an italic face and may slant the regular one itself. - Inheritance. Because the property is inherited, setting it on a container italicizes everything inside unless a child overrides it.
Browser support
The normal, italic and plain oblique values work in every browser; the oblique <angle> form is newer, so check a compatibility table before relying on it.
Related
font-weightโ choose a weightfont-synthesisโ control faux italicfont-variation-settingsโ the slnt and ital axesfontโ the shorthand- Lesson: Fonts