Category: 

What Is a Non-Breaking Space?

Article Details
  • Written By: Mary McMahon
  • Edited By: Kristen Osborne
  • Last Modified Date: 20 October 2014
  • Copyright Protected:
    2003-2014
    Conjecture Corporation
  • Print this Article
Free Widgets for your Site/Blog
Sharks hunt by sensing electromagnetic fields produced by their prey.  more...

October 24 ,  1929 :  The Black Thursday crash in the US stock market took place.  more...

A non-breaking space is a space what will be respected in layouts and displays by browsers and computer programs. Generally, simple spaces are treated as places where it is appropriate to place a line break, and multiple spaces may be collapsed by a browser when it displays, for convenience. With a non-breaking space, the space is held. There are a number of settings where this is appropriate and there is an HTML entity, &nbsp, used to code non-breaking spaces into a display.

The concept of the non-breaking space is a carryover from typesetting, where sentence spacing needed to be controlled to prevent awkward problems and for aesthetic reasons. With the development of electronic typesetting, people needed a way to control spaces in specific settings, and this was brought into the Internet as well. Controlling spacing and other elements when text is displayed allows people to customize the appearance of a website and the information presented.

In a simple example of a setting where people might want to use a non-breaking space, there are some things users might not want to see broken with a line break, like a formal title and name, such as “Mr. Jones,” or a measurement, like “16 cups.” Using a non-breaking space will ensure that a line break will not be inserted by a computer program or browser; if there is not enough room for it to fit on one line, it will be dropped to the next line down.

Ad

For certain formatting purposes, like poetry, non-breaking spaces can also be useful. People should be careful about using the HTML entity, as some browsers will treat a string of non-breaking spaces as a single space, and may change the formatting. Browsers also display content differently and content that looks acceptable in one browser may look odd in another; forcing white space with non-breaking spaces can result in display errors.

In HTML, non-breaking spaces are sometimes used to create space between visual elements, or to hold cells in a table open. Some browsers have difficulty reading empty cells and may move the elements of a table around, causing problems with layout. Sticking a non-breaking space inside the cell will alert the browser to the fact that the cell is supposed to be displayed as empty.

Many software programs insert non-breaking spaces automatically when they are appropriate, as do some "what you see is what you get" (WYSIWYG) editors used online. These programs use known spelling and grammar conventions to insert hard spaces when it is assumed that the user does not want a line break to appear.

Ad

More from Wisegeek

You might also Like

Discuss this Article

Post your comments

Post Anonymously

Login

username
password
forgot password?

Register

username
password
confirm
email