CSS font-style attribute
- Previous page font-stretch
- Next Page font-variant
Definition and Usage
The font-style property defines the font style.
Description
This property sets the use of italic, oblique, or normal font. Italic fonts are typically defined as a separate font within a font family. Theoretically, a user agent can calculate an italic font based on the normal font.
See Also:
CSS Tutorial:CSS Font
CSS Reference Manual:CSS font attribute
HTML DOM Reference Manual:fontStyle Property
Example
Set different font styles for three paragraphs:
p.normal {font-style:normal;} p.italic {font-style:italic;} p.oblique {font-style:oblique;}
CSS Syntax
font-style: normal|italic|oblique|initial|inherit;
Property Value
Value | Description |
---|---|
normal | Default Value. The browser displays a standard font style. |
italic | The browser will display an oblique font style. |
oblique | The browser will display an italic font style. |
inherit | Specifies that the font style should be inherited from the parent element. |
Technical Details
Default Value: | normal |
---|---|
Inheritance: | yes |
Version: | CSS1 |
JavaScript Syntax: | object.style.fontStyle="italic" |
Try It Yourself Example
- Set font style
- This example demonstrates how to set the font style.
Browser support
The numbers in the table indicate the first browser version that fully supports this attribute.
Chrome | IE / Edge | Firefox | Safari | Opera |
---|---|---|---|---|
1.0 | 4.0 | 1.0 | 1.0 | 7.0 |
- Previous page font-stretch
- Next Page font-variant