XML technologies / CSS / Advanced websites with CSS / Using fonts with CSS / Further font properties

(Excerpt from “CSS − Advanced websites with Cascading Stylesheets” by Rachel Andrew & Dan Shafer)

The font-style property

The property font-style determines the font style used for an element. The available values are normal, italic and oblique. The value normal produces the normal default font; italic (italic) and oblique (slanted) appear the same in all browsers.

Italics
For readers interested in typography, note that a font family’s italic face is used when available. Otherwise, the browser slants the Roman face. If the specified type is oblique and only an italic face is available, that face is used, and vice versa.

The font-variant property

The property font-variant has two values: normal and small-caps. The value normal displays normal mixed uppercase and lowercase text; small-caps displays small capitals. In an ideal world, every font family would have a small-cap face for the browser to use. Unfortunately, this is very rare. Instead, browsers simulate small caps with uppercase letters at smaller font sizes. These pseudo-small caps look almost like real ones, but have slightly lighter strokes and a lower character height. The following figure shows small-caps in the browser window.

Using small caps with font-variant

Figure: Using small caps with font-variant.

Internet Explorer through version 5 displays small caps as ordinary uppercase letters without reducing their size.

The font-weight property

The property font–weight describes a font’s stroke weight. Its relative values are bolder and lighter, determined by the parent element’s initial values. Absolute numeric values for font–weight range from 100 to 900 in increments of 100. The CSS2 specification also provides two constants, normal and bold. The first corresponds to the conventional normal weight of 400, the second to a bold weight of 700. Neither is supported by any current browser, however.

Because most browsers do not support all nine levels of font-weight and most system fonts lack enough faces with different weights, adjacent values may produce identical results. Only Adobe OpenType fonts are said to offer nine suitable faces, but I have not encountered their use in practice.

  

 

 

 

back to top