O'Reilly logo

Cascading Style Sheets: The Definitive Guide, Second Edition by Eric A. Meyer

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Styles and Variants

Compared with everything that’s gone before, this section is practically a no-brainer. The properties discussed herein are so straightforward, and the complexities are so minimal, that this will probably all come as a great relief. First, we’ll talk about font-style, and then move on to font-variant before wrapping up with the font properties.

Fonts with Style

font-style is very simple: it’s used to select between normal text, italic text, and oblique text. That’s it! The only complication is in recognizing the difference between italic and oblique text and in knowing why browsers don’t always give you a choice.

The default value of font-style is, as you can see, normal. This refers to “upright” text, which is probably best described as “text that is not italic or otherwise slanted.” The vast majority of text in this book is upright, for instance. That leaves only an explanation of the difference between italic and oblique text. For that, it’s easiest to turn to Figure 5-16, which illustrates the differences very clearly.

Italic and oblique text in detail

Figure 5-16. Italic and oblique text in detail

Basically, italic text is a separate font face, with small changes made to the structure of each letter to account for the altered appearance. This is especially true ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required