O'Reilly logo

Web Design in a Nutshell by Jennifer Niederst

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Layout Techniques with HTML

First, let it be stated that “layout techniques with HTML” is an oxymoron. HTML was specifically designed to pass off all layout functions to the end user. The controls over presentation listed here are the result of either extensions to the original HTML standard or a “creative use” (or misuse, depending who you ask) of an existing tag.

Ideally, presentation should be controlled using style sheets; however, they are not supported in enough browsers to be considered reliable. In the meantime, tables may offer more precise control over positioning than can be achieved using text-related HTML tags. (See Chapter 10 for more information on formatting with tables.)

Preformatted Text

Preformatted (<pre>) text is unique in that it is displayed exactly as it is typed in the HTML source code—including all line returns and multiple character spaces (in all other HTML text, returns and consecutive spaces are just ignored). Preformatted text is always displayed in a monospace font, which allows columns of characters to line up correctly.

The same block of source text was coded as <pre> text and as teletype (<tt>), another method for specifying a monospace font. The difference is obvious, as shown in Figures 7-13 and 7-14.

Preformatted text

Figure 7-13. Preformatted text

Teletype text

Figure 7-14. Teletype ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required