Skip to: content, navigation

font-style (CSS property)

Spec
Inherited Initial Version
Yes normal CSS1, 2
Browser support (more…)
IE5.5+ FF1+ SA1.3+ OP9.2+
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
5.5 6.0 7.0 1.0 1.5 2.0 1.3 2.0 3.0 9.2 9.5
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.

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

User-contributed notes

Add a note

To post a note on this topic, please log in with your SitePoint username and password. If you don't have an account yet, you can create a new account for free.

Related Products

Search