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. |
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 |
font-style |
Yes | Yes | Yes | Yes | Yes |
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 .j ava 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>