3.1. Appearances Can Deceive
Documents never look alike when displayed by a text editor and when
displayed by a browser. Take a look at any source document from the
World Wide Web. At the very least, return characters, tabs, and
leading spaces, although important for readability of the source text
document, are ignored for the most part. There also is a lot of extra
text in a source document, mostly from the display tags and
interactivity markers and their parameters that affect portions of
the document, but don't themselves appear in the display.
Accordingly, new authors are confronted with having to develop not
only a presentation style for their web pages, but a different style
for their source text. The source document's layout should
highlight the programming-like markup aspects of HTML and XHTML, not
their display aspects. And it should be readable not only by you, the
author, but by others as well.
Experienced document writers typically adopt a programming-like
style, albeit very relaxed, for their source text. We do the same
throughout this book, and that style will become apparent as you
compare our source examples with the actual display of the document
by a browser.
Our formatting style is simple, but it serves to create readable,
easily maintained documents:
-
Except for the document structural tags like
<html>, <head>, and
<body>, any element we use to structure the
content of a document is placed on a separate line and indented to
show its nesting level within the document. Such elements include
lists, forms, tables, and similar tags.
-
Any element used to control the appearance or style of text is
inserted in the current line of text. This includes basic font style
tags like <b> (bold text) and document
linkages like <a> (hypertext anchor).
-
Avoid, where possible, the breaking of a URL onto two lines.
-
Add extra newline characters to set apart special sections of the
source document, for instance, around paragraphs or tables.