html space character


HTML space code(   ) is a reserved keyword of HTML for giving space between words. It is also called a non-breaking space.
If you added multiple blank spaces in the HTML source code then the browser will remove all the spaces, and only a single blank space will be added. To avoid this behavior you have to use '   ' or '   '. These both are the same, The first one is entity number while the other one is entity name.


HTML space code example

1
<h2>Hello&nbsp;world!</h2>

Output

1
Hello World!

Multiple HTML space code example

You can add multiple spaces by adding multiple times ' &nbsp; ' A non-breaking space will not break the line. It will add only blank space.

1
<h2>Hello&nbsp;&nbsp;&nbsp;dear&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;world!</h2>

Output

1
Hello   dear     world!

Share