English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

CSS Reference Manual

CSS @rules

Comprehensive List of CSS Properties

CSS font-style attribute usage and examples

font-The style CSS attribute defines the font style of the element's text content.

The following table provides usage instructions and version history of this attribute, as well as its usage syntax in JavaScript scripts.

Default value:normal
Applicable to:All elements
Inheritance:Yes
Can be animated:No.Please see Animation properties.
Version:CSS 1,2,3
JavaScript syntax:object.style.fontStyle="italic"

font-The syntax of style usage

The syntax of this attribute is as follows:

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

The following example demonstrates how to use font-style attribute.

  p {
   font-style: italic;
  }
Test and see‹/›

Attribute value

The following table describes the value of this attribute.

ValueDescription
normalThe browser displays a standard font style.
italicThe browser will display a italic font style.
obliqueThe browser will display a italic font style.
inheritIf specified, the associated element adopts its parent element font-style attribute values.

Note:If there is no available italic or oblique, the oblique face can be rendered to synthesize the slope face by applying an oblique transformation to the slope face.

Browser compatibility

font-The compatibility of style attribute across browsers, the numbers in the table below represent the minimum version number of the browser that supports this attribute; all mainstream browsers support this attribute.

  • Firefox 1+

  • Google Chrome1+

  • Internet Explorer 4+

  • Apple Safari 1+

  • Opera 7+

Further reading

Please refer to the following tutorials:CSS font,CSS text.

Related attributes and rules:font,font-variant,font-weight,font-size,line-height,font-family,@font-face.