Skip to: content, navigation

by Tommy Olsson and Paul O’Brien

font-style (CSS property)

Browser support full matrix
IE5.5+ FF1+ Saf1.3+ Op9.2+
Full Full Full Full
Spec
Inherited Initial Version
Yes normal CSS1, 2

Example

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

.ship {
  font-style: italic;
}

Try it yourself!View all demos

Description

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

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

IE5.5Full
6.0Full
7.0Full
Firefox1.0Full
1.5Full
2.0Full
Safari1.3Full
2.0Full
3.0Full
Opera9.2Full
9.5Full

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

The Principles of Beautiful Web Design

Best Seller!

You don’t need to go to Art School to design great looking web sites!

Book Cover: The Principles of Beautiful Web Design

Download the FREE sample chapters