home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


Book HomeWeb Design in a NutshellSearch this book

8.3. Information Browsers Ignore

Some information in an HTML document, including certain tags, is ignored when the document is viewed in a browser. These include:

Line breaks

Line returns in the HTML document are ignored. Text and elements wrap continuously until they encounter a <p> or <br> tag within the flow of the document text. Line breaks are displayed, however, when text is tagged as preformatted text (<pre>).

Tabs and multiple spaces

When a browser encounters a tab or more than one consecutive blank character space in an HTML document, it displays it as a single space. So, if the document contains:

far,            far                away

the browser displays:

far, far away

Extra spaces can be added within the flow of text by using the nonbreaking spacecharacter entity (&nbsp;). Multiple spaces are displayed, however, when text is tagged as preformatted text (<pre>).

Multiple <p> tags

A series of paragraph tags (<p>...</p> or <p> alone) with no intervening text is interpreted as redundant by all browsers and displays as though it were only a single paragraph break. Most browsers display multiple <br> tags as multiple line breaks.

Unrecognized tags

A browser simply ignores any tag it doesn't understand or that was incorrectly specified. Depending on the tag and the browser, this can have varied results. The browser displays nothing at all, or it may display the contents of the tag as though it were normal text.

Text in comments

Browsers do not display text between the special <!-- and - -> elements used to denote a comment. Here is a sample comment:

<!-- This is a comment -->
<!-- This is a 
multiple line comment 
that ends here. -->

There must be a space after the initial <!-- and preceding the final - ->, but you can put nearly anything inside the comment otherwise. You cannot nest comments. Microsoft Internet Explorer also supports its own proprietary way of indicating comments with <comment> ... </comment> tags. Comments are useful for leaving notes within a long HTML file, for example:

<!-- navigation table starts here -->


Library Navigation Links

Copyright © 2002 O'Reilly & Associates. All rights reserved.