Skip to content
Related Articles

Related Articles

What is the entity name used for non-breaking space in HTML ?

View Discussion
Improve Article
Save Article
  • Last Updated : 16 May, 2022
View Discussion
Improve Article
Save Article

The     character entity is used to denote a non-breaking space which is a fixed space. This may be perceived as twice the space of a normal space. It is used to create a space in a line that cannot be broken by word wrap.

If we want to use Two spaces gap, we have to use   and to use four space –   is used.

Syntax:

 

Example 1: In this example, we are using single   to get one space.

HTML




<!DOCTYPE html>
<html>
<body>
    <h1 style="color: green;">
        GeeksforGeeks
    </h1>
    <p>This is a   regular space.</p>
</body>
</html>

Output:

 

Example 2: In this example, we are using a single 4 &nbsp; to get four spaces.

HTML




<!DOCTYPE html>
<html>
<body>
    <h1 style="color: green">
        GeeksforGeeks
    </h1>
    <p>This   is a   space    .</p>
</body>
</html>

Output:

 

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!