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 ...

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.