[ Pobierz całość w formacie PDF ]
(Typically, sizes for scalable fonts are rounded to the nearest whole pixel, while
the tolerance for bitmapped fonts could be as large as 20%.) Further computa-
tions, e.g. by ’em’ values in other properties, are based on the ’font-size’ value
that is used, not the one that is specified.
15.3 Font family: the ’font-family’ property
’font-family’
Value:
[[ family-name | generic-family ] [, family-name|
generic-family]* ] | inherit
Initial:
depends on user agent
Applies to:
all elements
Inherited:
yes
Percentages: N/A
Media:
visual
2 Aug 2002 21:33
192
Fonts
The value is a prioritized list of font family names and/or generic family names.
Unlike most other CSS properties, values are separated by a comma to indicate that
they are alternatives:
body { font-family: gill, helvetica, sans-serif }
Although many fonts provide the "missing character" glyph, typically an open box,
as its name implies this should not be considered a match.
There are two types of font family names:
family-name
The name of a font family of choice. In the last example, "gill" and "helvetica"
are font families.
generic-family
In the example above, the last value is a generic family name. The following
generic families are defined:
’serif’ (e.g. Times)
’sans-serif’ (e.g. Helvetica)
’cursive’ (e.g. Zapf-Chancery)
’fantasy’ (e.g. Western)
’monospace’ (e.g. Courier)
Style sheet designers are encouraged to offer a generic font family as a last
alternative.
Font names containing whitespace should be quoted:
body { font-family: "new century schoolbook", serif }
BODY STYLE="font-family: ’My own font’, fantasy"
If quoting is omitted, any whitespace characters before and after the font name are
ignored and any sequence of whitespace characters inside the font name is
converted to a single space.
15.4 Font styling: the ’font-style’ property
’font-style’
Value:
normal | italic | oblique | inherit
Initial:
normal
Applies to:
all elements
Inherited:
yes
Percentages: N/A
Media:
visual
193
2 Aug 2002 21:33
Fonts
The ’font-style’ property selects between normal (sometimes referred to as
"roman" or "upright"), italic and oblique faces within a font family.
A value of ’normal’ selects a font that is classified as ’normal’ in the UA’s font
database, while ’oblique’ selects a font that is labeled ’oblique’. A value of ’italic’
selects a font that is labeled ’italic’, or, if that is not available, one labeled ’oblique’.
The font that is labeled ’oblique’ in the UA’s font database may actually have been
generated by electronically slanting a normal font.
Fonts with Oblique, Slanted or Incline in their names will typically be labeled
’oblique’ in the UA’s font database. Fonts with Italic, Cursive or Kursiv in their names
will typically be labeled ’italic’.
h1, h2, h3 { font-style: italic }
h1 em { font-style: normal }
In the example above, emphasized text within ’H1’ will appear in a normal face.
15.5 Small-caps: the ’font-variant’ property
’font-variant’
Value:
normal | small-caps | inherit
Initial:
normal
Applies to:
all elements
Inherited:
yes
Percentages: N/A
Media:
visual
Another type of variation within a font family is the small-caps. In a small-caps font
the lower case letters look similar to the uppercase ones, but in a smaller size and
with slightly different proportions. The ’font-variant’ property selects that font.
A value of ’normal’ selects a font that is not a small-caps font, ’small-caps’ selects
a small-caps font. It is acceptable (but not required) in CSS 2.1 if the small-caps font
is a created by taking a normal font and replacing the lower case letters by scaled
uppercase characters. As a last resort, uppercase letters will be used as replace-
ment for a small-caps font.
The following example results in an ’H3’ element in small-caps, with emphasized
words in oblique small-caps:
h3 { font-variant: small-caps }
em { font-style: oblique }
There may be other variants in the font family as well, such as fonts with old-style
numerals, small-caps numerals, condensed or expanded letters, etc. CSS 2.1 has
no properties that select those.
2 Aug 2002 21:33
194
Fonts
Note: insofar as this property causes text to be transformed to uppercase, the
same considerations as for ’text-transform’ [p. ??] apply.
15.6 Font boldness: the ’font-weight’ property
’font-weight’ [ Pobierz całość w formacie PDF ]