CSS Property font-style








font-style sets the font to use an italic, oblique, or normal font face.

Summary

ItemValue
Initial value normal
Inherited Yes.
Version CSS1
JavaScript syntax object.style.fontStyle="italic"
Applies to All elements.




CSS Syntax

font-style: italic | normal | oblique | inherit

Property Values

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

Browser compatibility

font-style Yes Yes Yes Yes Yes




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 .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>

Click to view the demo