Using Monospace and Preformatted Text

Most of the text in this book is set in a proportional font. In a proportional font, characters take up various amounts of space horizontally depending on their sizes. For example, the letter M takes up more space than the letter I, so placing a string of Ms side-by-side occupies more space than a string of Is. Here are ten of each, to demonstrate:

MMMMMMMMMM

IIIIIIIIII

Most Web pages use proportional fonts because they are attractive and professional-looking. We’re accustomed to seeing proportional fonts, so they’re easy for most people to read.

In contrast, a monospace font is one in which each letter occupies the same amount of horizontal space, regardless of its actual size and shape. Back in the days of the ...

Get HTML and XHTML Step by Step 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.