Non-breaking Space - Use As Non-collapsing White-space

Use As Non-collapsing White-space

A second common application of non-breaking spaces is in plain text file formats such as SGML, HTML, TeX, and LaTeX, which sometimes treat sequences of whitespace characters (space, newline, tab, form feed, etc.) as if they were a single white-space character. Such “collapsing” of white-space allows the author to neatly arrange the source text using line breaks, indentation and other forms of spacing without affecting the final typeset result.

In contrast, non-breaking spaces are not merged with neighboring whitespace characters, and can therefore be used by an author to insert additional visible space in the formatted text. For example, in HTML, non-breaking spaces may be used in conjunction with a fixed-width font to create tabular alignment (monospace font used):

Column 1 Column 2
-------- --------
1.2 2.3

(note that the use of the pre tag, the whitespace:pre CSS rule, or a table are alternative, if not necessarily better, ways to achieve the same result in HTML)

If ordinary spaces are used instead then the spaces are collapsed when the HTML is rendered and the layout is broken:

Column 1 Column 2
-------- --------
1.2 2.3

Read more about this topic:  Non-breaking Space