Chapter 5. Text Structuring Essentials

IN THIS CHAPTER

  • Formatting paragraphs

  • Line breaks

  • Divisions

  • Rules

  • Block quotes

  • Preformatted text

The Web is used to transfer information in a variety of formats. However, text is still the main form of communication across the Internet and even on the multimedia-rich World Wide Web. As such, it is important to understand the methods you can employ with HTML to format text.

This chapter covers the big picture, that is, text at the division and paragraph level. The next chapter delves into character and other in-line formatting concepts.

Formatting Paragraphs

The most basic form to fit text within, whether in a book or on a Web page, is the paragraph. As you might have guessed, HTML supplies a paragraph tag to format text into discrete paragraphs.

The paragraph tags, <p> and </p>, provide the most basic block formatting for Web page text. Their use is straightforward: Place the opening tag (<p>) at the start of the paragraph and the ending tag (</p>) at the end of the paragraph. The user agent will format the paragraphs appropriately, usually by placing a blank line between them.

As an example, consider the following HTML code. Figure 5-1 shows the result of running this code in a browser.

<p>Welcome to The Oasis of Tranquility -- your source of day spa services at hair salon prices. Come visit us for that deep tissue or relaxing massage, facial, manicure, or hair coloring you have been putting off.</p> <p>Our concept is simple -- provide luxurious service ...

Get HTML, XHTML, and CSS Bible, Fourth Edition 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.