1. css
  2. /font style

CSS Font-Style Property

Introduction

The font-style property is a CSS property that allows you to control the style of the font used for an element. It allows you to set the font to be italic, oblique, or normal.

Basic Usage

To use the font-style property, you specify one of the following values:

  • normal: This is the default value, which sets the font to be normal, or not italic or oblique.
  • italic: This value sets the font to be italic, which slants the characters to the right.
  • oblique: This value sets the font to be oblique, which slants the characters to the right at a slightly less dramatic angle than italic.

Here is an example of using the font-style property to set the font style of an element:

.my-element {
  font-style: italic;
}

In the example above, we are setting the font style of the .my-element class to be italic.

Inheritance

The font-style property is an inherited property, which means that if you set the font style for an element, it will also be applied to that element's children. For example:

<div class="parent">
  <p class="child">This is some text</p>
</div>