A Complete Guide to Web Design

(やまだぃちぅ) #1
Layout Techniques with HTML 123

Formatting
Text

Layout Techniques with HTML

Web Design in a Nutshell, eMatter Edition

controls over presentation listed here are the result of either extensions to the orig-
inal 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 (

) 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). Prefor-
matted 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

text and as teletype (),
another method for specifying a monospace font. The difference is obvious, as
shown in Figures 7-13 and 7-14.


The

tag is the only HTML tag that lets you knowexactlyhow your text will
line up when displayed in a browser. For this reason, it was adopted early on as a


Figure 7-11: Nested unordered list


<UL>
<LI>Inline Type Styles
<LI>The FONT Tag
<LI>Lists
<UL>
<LI>Unordered Lists
<LI>Ordered Lists
<UL>
<LI>Changing the Numbering Scheme
<LI>Setting the First Number
</UL>
<LI>Definition Lists
<LI>Nesting Lists
</UL>
<LI>Layout Techniques with HTML
</UL>
Free download pdf