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 (
). 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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access