HTML and CSS Reference
Table 4-3. Absolute-size Keywords for the font-size Property
HTML font size
The default value of font-size is medium , which browsers use for all text other than headings. Although
these keywords are rarely used, the scaling factor and equivalent HTML heading sizes provide a useful guideline
for setting your own sizes using lengths or percentages. For example, the suggested scaling factor for a level 1
heading is double the size of ordinary text, but the suggested smallest size is three-fifths, not half.
The HTML font sizes in Table 4-3 refer to the size attribute in the deprecated <font> tag. They're included
here as a guide in case you need to convert an old site that uses outdated markup.
There are just two relative-size keywords:
Using one of these keywords increases or decreases the size of the font relative to the font size of the parent
element. For example, if the parent element has a font size of medium , using larger changes the current element's
font to large .
Using Length to Set Font Sizes
Tables 3-1 and 3-2 in the previous chapter list the units of measurement you can use to specify length. When
designing web pages for viewing onscreen, em and px are the most important. The rem unit will gain importance
when Internet Explorer (IE) 8 and earlier no longer have a significant market share.
Apart from minor variations between browsers, CSS pixels are a fixed size. As a result, using px is much
simpler than em , which is a relative measurement. The default size browsers use for the text in paragraphs is 16px .
To make the text slightly smaller, you can set the font size in pixels like this:
To do the same with em , you need to calculate the ratio of 14px to the default 16px —in other words, 0.875 . So
the equivalent style rule becomes this: