Internet
Fact-checked

At EasyTechJunkie, we're committed to delivering accurate, trustworthy information. Our expert-authored content is rigorously fact-checked and sourced from credible authorities. Discover how we uphold the highest standards in providing you with reliable knowledge.

Learn more...

What is a Non-Breaking Space?

A non-breaking space is a unique character in digital text that prevents an automatic line break at its location. It's like an invisible glue, keeping words or elements together on the same line. This ensures that certain phrases or terms remain unsplit, preserving readability and aesthetic appeal. Curious about where else non-breaking spaces can be crucial? Let's explore their impact together.
Mary McMahon
Mary McMahon
Mary McMahon
Mary McMahon

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.

Man holding computer
Man holding computer

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.

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.

Mary McMahon
Mary McMahon

Ever since she began contributing to the site several years ago, Mary has embraced the exciting challenge of being a EasyTechJunkie researcher and writer. Mary has a liberal arts degree from Goddard College and spends her free time reading, cooking, and exploring the great outdoors.

Learn more...
Mary McMahon
Mary McMahon

Ever since she began contributing to the site several years ago, Mary has embraced the exciting challenge of being a EasyTechJunkie researcher and writer. Mary has a liberal arts degree from Goddard College and spends her free time reading, cooking, and exploring the great outdoors.

Learn more...

You might also Like

Discuss this Article

Post your comments
Login:
Forgot password?
Register:
    • Man holding computer
      Man holding computer