font-style
Description
font-style
sets the font to use an italic, oblique, or normal font face.
Item | Value |
---|---|
Initial value | normal |
Inherited | Yes. |
Version | CSS1 |
JavaScript syntax | object.style.fontStyle="italic" |
Applies to | All elements. |
Syntax and Property Values
font-style: italic | normal | oblique | inherit
The property values are listed in the following table.
Value | Description |
---|---|
normal | A normal font style. This is default |
italic | An italic font style |
oblique | An oblique font style |
inherit | Inherit the font style from the parent element |
Example
The following code sets font-style
for em
and i
.
em {font-style: oblique;}
i {font-style: italic;}
<!DOCTYPE HTML>
<html>
<head>
<style>
p {<!--from www . ja v a 2s. c o m-->
font-size: 25px;
}
p#oblique {
font-style: oblique;
}
</style>
</head>
<body>
<p id='oblique'>
This font is oblique.
</p>
</body>
</html>
The code above generates the following result.