What NBSP means and does

For such an easy to understand HTML entity, the non-breaking space (NBSP,  ) is being misused way too often.

Non-breaking spaces are just what they sound like — spaces where a line break will not occur. You should not use them to add space between words, sentences, or elements. Especially not elements.

At first glance, this may seem like a meaningless issue, but it can influence the overall quality of your website.

An example follows:

Lorem ipsum.  Dolor sit amet.

Which of course results in:

Lorem ipsum.  Dolor sit amet.

Notice the extra space between the sentences?

Instead of this, consider using other entities, as explained in Richard Rutter’s article Use a single word space between sentences. Bear in mind that, while some people prefer a bit of extra space between sentences, others will find it irritating. It creates a large gap, which a lot of people are not at all used to.

One of the main reasons perhaps, why people use non-breaking spaces the way they shouldn’t, is the popular W3Schools, where you can read the following:

Normally HTML will truncate spaces in your text. If you write 10 spaces in your text HTML will remove 9 of them. To add spaces to your text, use the   character entity.

Ten spaces will become one, but you shouldn’t use the   to get around that.

Here’s an example where you could, and should, use a non-breaking space:

Mr. Smith

Which basically means a space will occur, but a line break will not, between words “Mr.” and “Smith”.

Next Post:
Previous Post: