The Habitat
Share to PinterestHow to Insert Spaces in HTML
Share to PinterestHow to Insert Spaces in HTML

HTML stands for "hypertext markup language." It is the language that browsers read when you are presented with a website when you do a search on the internet. There are plenty of other languages used today by programmers and site developers, but HTML is still considered the standard for web design. The basic elements of a site are all included in HTML language. Even when online design templates are used, it is still important to know some basic HTML, including how to insert spaces within your HTML.


Use the nbsp characters for a non-breaking space.

Share to Pinterest183381310

HTML, unlike an MS Word document, does not recognize an extra space that is simply typed with the space bar. Instead, you have to use the language and symbols of HTML to get the result you want. To insert a non-breaking space in your HTML, type "&nbsp" after the place where you want the extra space. Then it will recognize it as a space that you want in that location of your document. Keep in mind that you should not overuse this technique too many times in a row as it may confuse the browsers.

virusowy / Getty Images


Insert multiple spaces with this technique.

Share to Pinterest832282452

scanrail / Getty Images

If you need to insert more than one space after a word, you can use the "&ensp" for two space. For four spaces, type "&emsp." You can use the tab selection, then hit the "&nbsp" characters four times in a row for inserting a longer space after words. Any of these strategies will work to add more white space after selected words within your HTML document.


Indent paragraphs using cascading style sheets.

Share to Pinterest844472230

NicoElNino / Getty Images

Cascading style sheets (CSS) are an HTML-based protocol that allows you to insert HTML less formally. Using CSS methods, you do not have to use the long form of HTML, therefore saving time. The format of CSS is different than standard HTML, but it does include HTML within it. You can use CSS format to indent, thereby creating the spaces you need within your HTML. One line you can use to insert this is <style>p. indent {padding-left: 1.8 em}</style> Remember that this code needs to be put between the <head></head> tags within your HTML.


Use this tag to create line breaks.

Share to Pinterest842140546

Abscent84 / Getty Images

Once you have learned to create spaces within your lines, you will want to learn to create spaces at the end of the line to create line breaks. To create a line break at the end of a line, type "<br>" at the place where you want to insert the break. This will cause the cursor to skip down the line. Creating line breaks is a good idea with any document or online HTML. If do not utilize this technique, you will end up with too many lines together, which may decrease readability. This is especially important with online blogs or websites where you want people to enjoy reading your content.


Use this character tag to define a new paragraph.

Share to Pinterest519037552

exdez / Getty Images

Sometimes it becomes necessary to create a new paragraph within your HTML document. Like the line break, this helps establish a new section of your text and helps clean up the look of your work. This makes it more readable and easy to navigate.

If you need to create a new paragraph, type the <p> character at the point where you want to place the indention. This should serve to help the look of the document while you are creating your content.


Use the pre-formatted text option to read spaces.

Share to Pinterest494345930

welcomia / Getty Images

If you want to be able to read the spaces that you create using the enter key, you can do so by inserting a simple HTML tag before and after the pre-formatted text area. Just type the words that you want to be formatted between the tags like this: <pre>Format this text.</pre> Once you do this, any spaces you insert with the "enter" key will be displayed through this technique.


Double-check to avoid "sloppy HTML."

Share to Pinterest171255468

mrPliskin / Getty Images

One of the problems that programmers experience when creating HTML is that they are not clear on which tags to use where. This can result in sloppy HTML and can wreak havoc on a page. Merely double-checking all of your HTML codes and tags before submitting it or publishing it can avoid these issues. Check for tabs, space breaks, proper grammar, punctuation, and other items within your HTML. Also follow the rules of HTML regarding the order of the tags, starting with the HTML tag, the "head" tag, and others.


Align your text on the web page.

Share to Pinterest599145696

Savushkin / Getty Images

The basic elements of HTML are important when creating a page using HTML coding language. One of the most basic elements is the aligning of your page with the correct margins and format. You can use the "left align," "center align," or "right align" functions if you are in a graphics editor. If not, you will have to include the following tags to align your text using HTML coding:

<p style=text-align: left;">Left align</p>

The above tags will create a document that is left aligned using HTML coding language.


Preview your HTML before publishing.

Share to Pinterest860901052

SolStock / Getty Images

One mistake some HTML coders do is that they do not preview or proofread their HTML before publishing or submitting. This can result in errors that will produce a poor user experience. To improve this, always try out your coding in an HTML previewer or publish it where only you can see it first. This will avoid any coding errors that cause erratic or sloppy HTML. In the movie, War Games, the central character, Matthew Broderick, having finally figured out the password to get into the computer, says, "It can't be that simple." The truth is it often is that simple and it is the simple errors such as leaving out a tag or character that causes most of the issues when coding HTML.


Learn HTML5.

Share to Pinterest929569176

relif / Getty Images

Another tip we will leave with you is that you should put it on your list to learn HTML5. It includes many elements of the standard HTML language, as well as the more modern aspects of programming that are used in app development and other applications. If you learn HTML5, you'll have more tricks in your arsenal to use when coding for websites, blogs, or other online applications and programs.



Scroll Down

for the Next Article