HTML and CSS Reference
In-Depth Information
Name
font-size
Values:
xx-small | x-small | small | medium | large | x-large | xx-large | smaller | larger |
<length> | <percentage>
Initial value:
medium
Applies to:
All elements
Inherited:
Yes
Percentages:
Calculated with respect to the parent element's font size
Computed value:
An absolute length
Description:
Defines the size of the font. The size can be defined as an absolute size, a relative size, a length
value, or a percentage value. Negative length and percentage values are not permitted. The
dangers of font-size assignment are many and varied, and points are particularly discouraged
in web design, as there is no certain relationship between points and the pixels on a monitor.
It's a matter of historical interest that because of early misunderstandings, setting the font-
size to medium led to different results in early versions of Internet Explorer and Navigator
4.x. Some of these problems are covered in Chapter 5 of CSS:TheDefinitiveGuide , third edi-
tion (O'Reilly); for further discussion, refer to http://style.cleverchimp.com/ . For best results,
authors are encouraged to use either percentages or em units for font sizing. As a last resort,
pixel sizes can be used, but this approach has serious accessibility penalties because it pre-
vents users from resizing text in IE/Win, even when it is too small to read comfortably. Most
other browsers allow users to resize text regardless of how it has been sized.
Search WWH ::




Custom Search