How to Insert Spaces in HTML … it will be very interesting to understand and use. When the space bar is pressed more than once, you will notice that it results in only one space to appear in HTML. But when you need to insert more than one space at a time, you’ll require to use HTML tags.
Methods to Insert Spaces in HTML
There are three ways through which you can insert spaces in HTML. It can be done using :-
- HTML
- CSS
- Pre-Formatted Text
HTML
Open an HTML document. Editing can be done in an HTML document using a text editor like NotePad, or TextEdit on Windows. You may also opt for an HTML editor like Adobe Dreamweaver. Try to follow the steps given under to open an HTML document.
Navigate to the HTML document in File Explorer on Windows, or the Finder on Mac.
- Right-click the HTML document you wish to edit.
- Place the cursor over Open with.
- Tap that particular program you wish use to edit the document.
Press space to add a normal space. To add a regular space, tap where you wish to induce the space and tap the space bar. Typically, HTML will show only single space between words. It does not matter how many times you tap on the space bar.
Type to force an extra space. This is called a non-breaking space because it prevents to draw a line break at that location.
- For example, typing Hi Everyone ! would be seen as in an extra space between “Hi” and “Everyone!”
- Browsers will show trouble inserting line breaks in a tidy and readable manner when you overuse the character.
- You can also try to type to force a space.
Insert spaces of varying widths. You can insert a bit longer space by using the following options. You can wse any one of them:
- Two spaces : Type  
- Four spaces : Type  
- Indent : Type

CSS
Tap to Open HTML or CSS document. CSS applied to the head of an HTML document. It can also be written as an external CSS document.
The top of the file is where the head of an HTML document is placed. It lies in between the “<head>” and “</head>” tags.
Create a style section for the CSS. The style section is placed in the head of the HTML code. It can be also placed on a separate style sheet. Use the following tags for creating a style section in the HTML or style sheet document.
- Type <style> : to open style section. Every CSS code goes after the tag.
- Type </style> : to close style section. Every CSS code goes before the closing tag.
Type the following tag in the style area: p {indent-text: 5em;} to create and show the browser to create an indent space of 5 spaces when at the proper HTML code.
- You may change/adjust the number of spaces by typing another number after “indent-text:”
- The “em” unit is equal to one space at the specified font size. You can even use other units, such as percentage like, “indent-text: 25%;” or measurements i.e “indent-text: 9mm;”.
Type <p> where you wish to add an indent space. This goes anywhere in the body of the HTML document you wish to indent the text. This will add an indent in the text which will match the specifications in the CSS.

Pre-Formatted Text
Open an HTML document. You can edit an HTML document through a text editor like NotePad, or TextEdit on Windows. You can even utilize an HTML editor like Adobe Dreamweaver. Use the given steps to tap open an HTML document.
- Navigate to the HTML document in File Explorer on Windows, or the Finder on Mac.
- Right-click to tap the HTML document you wish to get edited.
- place the cursor over Open with.
- Tap the program you wish to use to edit the document.
Type <pre> before the text that you wish to pre-format. This will the opening tag for pre-formatted text.
Type the text exactly as intended after the “<pre>” tag. By pre-formatting the text, spaces and any line-breaks created thereof, by tapping “Enter” will be shown on the HTML page.
Type </pre> after the text. This ends the pre-formatted text section.
Hope the above step wise instruction will help you to insert spaces in HTML.