Tuesday, September 14, 2010

Defining font-style, font-weight, and font-variant

These three properties are straightforward. The first, font-style, enables you to set italic
or oblique text. The former is often a defined face within the font itself, whereas the latter
is usually computed. Typically, web browsers treat both the same, and only the italic
value is in general use (except for the occasional use of normal—the default value—in
order to override something set elsewhere).
An element’s font-style is set like this:
h2 {
font-style: italic;
}
The font-weight property is intended to make a font heavier or lighter, and despite the
various available values, only bold and normal are in general use. This is detailed in full in
the font-weight entry of Appendix D (CSS Reference).
.introParagraph {
font-weight: bold;
}
The font-variant property has two available values: normal (the default) and small-caps.
Small caps are often used to de-emphasize uppercase letters in abbreviations and
acronyms, and are similar in size to a typeface’s lowercase characters. This property only
affects lowercase letters, and display of small caps varies across browsers and platforms—
for example, older versions of Internet Explorer simply render such text entirely in normal
caps (i.e., in standard uppercase letters).

No comments:

Post a Comment