Non-Breaking Space

As you may have seen, a web browser will ignore all extraneous spaces in your HTML files. However, there may be times when you really want to have more than one space. When? Some writers like to have two spaces following the period at the end of the sentence. What if you wanted to indent the first sentence of every paragraph? How about having a single word with its individual letters spaced far apart?

An HTML code for adding a space character is the special character known as the non-breaking space:

 

Here are some examples of how you might use the non-breaking space:

  1. Two non-breaking spaces are used to spread the letters in a word farther apart:

B   R   I   A   N   O

The markup for the line above looks exactly like this:

<p><tt><strong>B &nbsp; R &nbsp; I &nbsp; A &nbsp; N &nbsp; O</strong></tt></p>

  1. One extra space is added at the end of each sentence, which is the common rule in typed documents:

Oct. 10, 2005 issue - For more than a decade, Abu Sajad's small convenience store was a fixture in Doura, an industrial neighborhood in south Baghdad.  Customers came for friendly service and the ease of buying rice, tea or cigarettes a few blocks from home.   Abu Sajad, a 44-year-old with salt-and-pepper hair, would even let regulars—Sunnis, Shiites or Christians—run up a tab.   But not long ago, Abu Sajad was found in a pool of his own blood.   Sunni insurgents had shot him 11 times with an AK-47.  Shortly afterward, his widow and four children left for Karbala, a Shiite town in the south.   His brother, Abu Naseer, decided to move to Al Kurayat, a predominantly Shiite neighborhood in eastern Baghdad.   The Doura shop was closed, another debris-strewn relic of an Iraq that may no longer exist.   "I have no reason or explanation why he was killed except that he was Shiite," says his brother.

The markup for the paragraph above looks like this.

  1. Two non-breaking spaces (&nbsp; &nbsp;) are used to indent the first sentence of each paragraph:

    "According to this post at Dirson's blog, Google and Sun Microsystems are to announce a new and kick-ass webtool: an Office Suite based on Sun's OpenOffice and accesible with your browser. Today at 10:30h (Pacific Time) two companies are holding a conference with more details, but Jonathan Schwartz (President of Sun Microsystems) claimed on Saturday on this post of his blog that "the world is about to change this week", predicting new ways to access software."