Login for Software or Support

CoffeeCup - HTML Editor, Flash & Web Design Software

Over 48,871,545 Downloads in 87 Countries

Tell a Friend About Our Cool Software

Buy the Book Here !

Chapter 2: White Space


The term white space refers to characters that take up space in a document but do not actually display. They are the space, the tab, and the new line, which causes subsequent text to move to the next line (the new line is sometimes called the line feed or carriage return). HTML handles white space in content by ignoring it. Well, not quite--any white space is simply converted to a single space. This is sometimes referred to as white space normalization. The white space can be a row of 10 spaces, a pair of new line characters, several tabs, or any combination of these, and the resulting display will have just a single space in the content.

Let's see this in action. The following HTML will display as a single line, with one space between words, just as you would expect:

<p>one two three four five</p>

Because of the way HTML handles white space, the following HTML will display exactly the same way:

<p>one
     two    three

four
five </p>


White space normalization in HTML has two practical consequences:

  • You can use white space to format your HTML source code as you like, using new lines, tabs, and spaces to organize the code in a way that's clear and easy to read. It will have no effect on the final rendering of the document.
  • You cannot use white space to format the content because it will have no effect. You must use HTML tags for this purpose.
You can tell HTML not to normalize white space by including text within the preformat <pre> tags. This can be useful when you have some text that is already formatted the way you want with white space, such as a poem. I will cover the <pre> tag in Chapter 3.


Table of Contents
Download Our Software:

... and don't forget about our Free Software

CoffeeCup Home Page | Software | Copyright & Legal | Site Map | © 1996 - 2008 CoffeeCup Software, Inc.