• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 5. HTML Overview > Information Browsers Ignore

5.5. Information Browsers Ignore

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


Line breaks

Line returns in the HTML document are ignored. Text and elements will 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 will display it as a single space. So, if the document contains:

far,            far                away

the browser will display:

far, far away

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


Multiple <p> tags

A series of <p> (paragraph) tags with no intervening text is interpreted as redundant by all browsers and will display as though it were only a single <p> tag. Most browsers will 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. Either the browser will display nothing at all, or it may display the contents of the tag as though it were normal text.


Text in comments

Browsers will 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 has its own proprietary way of indicating comments with <comment> ... </comment> tags. This markup is not supported by any other browser.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint