CSS font-style
➔ The font-style property is used to specify what type of font to display.
The basics of CSS font-styling.
➔ If no font-style is applied, the browser will display the font in a regular, normal style.
➔ Italic font faces are usually cursive in nature and generally use less horizontal space than unstyled fonts.
➔ oblique faces are usually slanted versions of regular font faces, and this slant can be changed between -90 degrees and 90 degrees. If the angle is not specified, the default 14 degrees is used. For positive values, the font faces are slanted towards the end of the line, and for negative values, they are slanted towards the beginning of the line..
Syntax
font-style: normal|italic|oblique|initial|inherit;
Property values
| Value | Description |
|---|---|
| normal | Displays the text in a regular font face. This is default. |
| italic | Displays a font using italic face. |
| oblique | Displays a font using the oblique style. |
| initial | Sets the property to its default value. |
| inherit | The element inherits the property value from its parent element. |
Example
#p1 {
font-style: italic;
}
#p2 {
font-style: oblique;
}
#p3 {
font-style: normal;
}
Click on the "Try it Now" button to see how it works.