Author:
Joan Hall
Date Of Creation:
28 July 2021
Update Date:
23 June 2024
![how to insert spaces in html](https://i.ytimg.com/vi/S-bD3bphlD4/hqdefault.jpg)
Content
1 Open an HTML document. This can be done in a regular text editor such as Notepad or TextEdit on Windows. You can also use an HTML file editor such as Adobe Dreamweaver. To open an HTML document:- Navigate to the HTML document in Explorer (Windows) or Finder (macOS).
- Right click on the desired HTML document.
- Hover over Open With.
- Select the program in which you want to edit the document.
![](https://a.vvvvvv.in.ua/society/kak-vstavit-probeli-v-html.webp)
![](https://a.vvvvvv.in.ua/society/kak-sdelat-dekupazh.webp)
- For example, if you enter Hi everyone, between the words "Hello" and "everyone!" an extra space will be inserted.
- Keep in mind that too many non-breaking spaces will prevent the browser from making line breaks in the right places, making the text difficult to read.
- You can also enter to insert a space.
![](https://a.vvvvvv.in.ua/society/kak-sdelat-dekupazh.webp)
- Two spaces - enter
- Four spaces - enter
- Indent (Tab Spacing) - enter
Method 2 of 3: CSS
1 Open an HTML or CSS document. The CSS code can be inserted into the head of an HTML document or saved as an external CSS file.
- The head of the HTML document is located at the top of the file, between the "head>" and "/ head>" tags.
2 Create a styling section for CSS. The style section is located at the beginning of the HTML code or in a separate style sheet.Use the following tags to create a style section in an HTML document or style sheet.
- Enter style>to open the style section. All CSS code will go after this tag.
- Enter / style>to close the style section. All CSS must be placed before this end tag.
3 Enter the following tag in the style section:p {indent-text: 5em;} This tells the browser to indent it by 5 spaces (in the correct HTML).
- To set the number of spaces, change the number after "indent-text:".
- The "em" element matches one space with the specified font size. Other units can be used, such as percent ("Indent-text: 15%;") or millimeters ("Indent-text: 3mm;").
4 Enter p> where you want to add indentation. Do this inside the HTML document where you want to indent. The text will be indented according to the CSS specifications.
Method 3 of 3: Preformatted text
1 Open an HTML document. This can be done in a regular text editor such as Notepad or TextEdit on Windows. You can also use an HTML file editor such as Adobe Dreamweaver. To open an HTML document:
- Navigate to the HTML document in Explorer (Windows) or Finder (macOS).
- Right click on the desired HTML document.
- Hover over Open With.
- Select the program in which you want to edit the document.
2 Enter pre> before the text you want to preformat. This is the opening tag for preformatted text.
3 Enter the text as intended after the "pre>" tag. When preformatting the text, any spaces and line breaks created by pressing Enter will be displayed on the HTML page.
4 Enter / pre> at the end of the text. This is the closing tag for preformatted text.
Tips
- If the browser displays spaces as incomprehensible characters, this is most likely due to additional data; they are stored in word processing format and are not displayed on the screen. To avoid this, work in a regular text editor such as Notepad or TextEdit.
- CSS is a much more powerful and predictable way of creating the layout of a web page, including word spacing.
- A non-breaking space is an example of a character entity; it is a code that refers to a character that cannot be entered from the keyboard.
Warnings
- HTML symbol for Tab ↹ (tabs) doesn't work the way many people think. There are no tab stops in a regular HTML file, so entering this character will do nothing.
- Enter HTML in a code editor or plain text file rather than a powerful text editor.