Applying Font Families to Text

With an idea of what you can reasonably choose from, it's time to go ahead and apply font families to your text. To do this, you select the text in question, and then use the font-family property and an associated value.

The value you use for the font-family property can be a single font name, a font family keyword, or a series of names followed by a font family keyword.

Single Font Names

Choose this technique only when you are absolutely certain that your audience has the font in question.

body {font-family: Arial;}

This sets the default font for all documents to Arial. The problem with this technique is that if the user doesn't have Arial installed on his or her machine, the browser will use the default ...

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.