Definition and Usage
The font-style CSS property allows italic or oblique faces to be selected within a font-family.
- Initialnormal
- Applies toall elements
- Inheritedyes
- Mediavisual
- Computed Valueas specified
- Animatableno
- Canonical orderthe unique non-ambiguous order defined by the formal grammar
Syntax
Formal syntax: normal | italic | oblique
font-style: normal font-style: italic font-style: oblique font-style: inherit
Values
Italic forms are generally cursive in nature while oblique faces are typically sloped versions of the regular face. Oblique faces can be simulated by artificially sloping the glyphs of the regular face.
- normal
- Selects a font that is classified as normal within a font-family
- italic
- Selects a font that is labeled italic, if that is not available, one labeled oblique
- oblique
- Selects a font that is labeled oblique
Examples
This paragraph is italic.
This paragraph is oblique.
The above example shows the two font-style
values. The CSS looks like this:
1 |
p. italic { font-style : italic } |
2 |
p. oblique { font-style : oblique } |
And the HTML looks like this:
1 |
< p class = "italic" >This paragraph is italic.</ p > |
2 |
< p class = "oblique" >This paragraph is oblique.</ p > |
Compatibility
Desktop browsers
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|
Basic support | 1.0 | 1.0 (1.7 or earlier) | 4.0 | 7.0 | 1.0 |
Mobile browsers
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|
Basic support | 1.0 | 1.0 (1) | 6.0 | 6.0 | 1.0 |