HTML and CSS Reference
In-Depth Information
The web page in Figure 7.3 contains some text that uses the font-variant property as
well as all the other properties described in this section.
.
Output
FIGURE 7.3
Text styled using
CSS.
Preformatted Text
Most of the time, text in an HTML file is formatted based on the HTML tags used to
mark up that text. In Lesson 3, “Introducing HTML and XHTML,” I mentioned that any
extra whitespace (spaces, tabs, returns) that you include in your HTML source is stripped
out by the browser.
The one exception to this rule is the preformatted text tag <pre> . Any whitespace that
you put into text surrounded by the <pre> and </pre> tags is retained in the final output.
With these tags, the spacing in the text in the HTML source is preserved when it's dis-
played on the page.
The catch is that preformatted text usually is displayed (in graphical displays, at least) in
a monospaced font such as Courier. Preformatted text is excellent for displaying code
examples in which you want the text formatted with exactly the indentation the author
used. Because you can use the <pre> tag to align text by padding it with spaces, you can
use it for simple tables. However, the fact that the tables are presented in a monospaced
font might make them less than ideal. (You'll learn how to create real tables in Lesson
10, “Building Tables.”) The following is an example of a table created with <pre> :
7
 
 
Search WWH ::




Custom Search