font-style (CSS property)

Spec
Inherited Initial Version
Yes normal CSS1, 2
Browser support (more…)
IE5.5+ FF1+ SA1.3+ OP9.2+ CH2+
Full Full Full Full Full

Syntax

font-style: { italic | normal | oblique | inherit } ;

Description

This property sets the font style to be applied for the text content of an element.

Example

This style rule makes all elements that belong to the "ship" class render as italics:

.ship {
  font-style: italic;
}

Value

italic
This value specifies a font that’s labeled “italic” in the user agent’s font database. If such a font isn’t available, it will use one labeled “oblique.”
normal
This value specifies a font classified as “normal” in the user agent’s font database. This is typically a Roman (upright) font for Latin characters.
oblique
This value specifies a font labeled “oblique” in the user agent’s font database. This may not be a true oblique font, but may be generated by slanting a Roman font.

Compatibility

Internet Explorer Firefox Safari Opera Chrome
5.5 6.0 7.0 8.0 1.0 1.5 2.0 3.0 3.5 1.3 2.0 3.1 4.0 9.2 9.5 10.0 2.0
Full Full Full Full Full Full Full Full Full Full Full Full Full Full Full Full Full

In Internet Explorer for Windows versions up to and including 7, the calculation of widths for inline blocks is incorrect when an italic or oblique font is used. This can cause the element to overflow, which may break float-based layouts due to the incorrect handling of overflow in those browsers. The solution would be to nest an inner element that holds the content that has a slightly smaller width than the parent so that when the element is stretched it still remains smaller than the parent..

Internet Explorer for Windows versions up to and including 7 don’t support the value inherit.

User-contributed notes

Related Products