HTML and CSS

Working with Page Breaks

Page breaks force a break in a line found within a paragraph. They are especially useful when forced line breaks are important to the flow of the text, such as in a poem (see Example 2-3).

Example 2-3. Working with page breaks
<p>What earthly tongue, and, oh! what human pen<br />
Can tell that scene of suffering, too severe.<br />
'Tis ever present to my sight, oh! When<br />
Will the sound cease its torture on mine ear?</p>

You'll note that I've first placed these lines of markup in a paragraph because you'll want them to have some kind of structure. The paragraph is a logical choice because a poem is really a series of paragraphs, broken by line. Figure 2-3 shows the way the browser displays breaks.

Figure 2-3. A paragraph with forced line breaks.

NOTE

You will also see breaks that look like this: <br>. This is how breaks are written in HTML.


Avoid Paragraphs and Breaks for Use in Display

As mentioned earlier, many people creating web pages rely on tags they shouldn't to achieve display. For example, some people stack breaks on top of one another to get whitespace into the document.

This is problematic because it causes the document to have markup in it that is not being used meaningfully. Because we now can use CSS confidently for these types of display concerns, use paragraphs and breaks for their intended use only: the formatting of paragraphs and line breaks.