Sizing Fonts

In this section, you'll learn to size fonts using the font-size property along with an absolute, relative, length, or percentage value.

Absolute and Relative Keywords

Absolute keywords size fonts based on the way that the browser computes their size. The keywords available are xx-small, x-small, small, medium, large, x-large, and xx-large. Here, I've applied an absolute keyword to paragraph text:

p {font-size: medium;}

The medium size is typically equivalent to the browser's default size for that element. Figure 9-3 shows all the keywords as applied to default browser text.

Figure 9-3. Absolute keyword sizing within a web browser.

Where absolute keywords are dependent upon the browser's computation of fonts, the relative ...

Get Spring Into HTML and CSS now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.