font-style

Description

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

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

Click to view the demo

The code above generates the following result.

font-style




















Home »
  HTML CSS »
    HTML CSS Reference »




HTML Tag Reference
CSS Reference
CSS Selector Reference
Encoding Reference