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.
Figure 7-13. Preformatted text
Figure 7-14. Teletype ...
Get Web Design in a Nutshell 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.