A Web Page’s Text Content

The text contained within elements is perhaps a Web page’s most basic ingredient. If you’ve ever used a word processor, you’ve typed some text. Text in an (X)HTML page, however, has some important differences.

First, (X)HTML collapses extra spaces or tabs into a single space and either converts returns and line feeds into a single space or ignores them altogether (Figures 1.10 and 1.11).

Figure 1.10. The text content is basically anything outside of the markup. Note that each line happens to be separated with a carriage return. Also, I’ve used a special character reference © for the copyright symbol to ensure that it is properly displayed no matter how I save this document.

Figure 1.11. Note how the extra ...

Get HTML, XHTML, & CSS, Sixth Edition: Visual QuickStart Guide 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.