font-style - HTML CSS CSS Property

HTML CSS examples for CSS Property:font-style

Description

This font-style CSS property sets the font style for the text content.

The following table font-style Property.

Item Value
Default value: normal
Applies to:All elements
Inherited: Yes
Animatable: No.

Syntax

The syntax of the property is as follows:


font-style:     normal | italic | oblique | initial | inherit

Property Values

The following table describes the values of this property.

Value Description
normal Selects a font that is normal in the user agent's font database.
italic Selects a font that is labeled italic in the user agent's font database, if that is not available, it will use one labeled oblique.
oblique Selects a font that is labeled oblique in the user agent's font database.
inherit take the value of its parent element font-style property.

The example below shows the font-style property.

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html lang="en">
 <head>
  <title>Example of CSS font-style property</title>
  <style type="text/css">
    p.normal {<!--   w w  w  . ja v  a 2 s  .  c o m-->
      font-style: normal;
    }
    p.italic {
      font-style: italic;
    }
    p.oblique {
      font-style: oblique;
    }
    </style>
 </head>
 <body>
  <p class="normal">This is a normal paragraph.</p>
  <p class="italic">This is a paragraph with italic font style.</p>
  <p class="oblique">This is a paragraph with oblique font style.</p>
 </body>
</html>

Related Tutorials