How to Create Spacing in Paragraphs in HTML
Learn how to easily add spacing in paragraphs in HTML
For you as a beginner who wants to create a website, of course learning HTML is one of the obligations that must be done. Because HTML is the standard programming language used to build a website.
One of the most important components you should know about is creating spaces in HTML. Of course, you as a website maker must provide comfort for your readers or website visitors by providing the right distance to the writing to make it look attractive and easy to read.
How to Create Spaces in HTML
There are various ways you can use to create spaces in HTML. Here are some ways that you can use according to the needs of your website.
The first way to create spaces in HTML is to use the code or non breaking space. This single HTML space code has a value of one space. What this means is that every code you write is equivalent to one click of the space bar. The following is the script or code for use
The following is the result of the script or code above:
You need to remember that no matter how many times you click the spacebar on the keyboard, the result that will be displayed is still one space. This is because HTML only recognizes one click for a space. However, if you want to use more than one space to separate words, you can use this script. For example like the image below.
One of the advantages of using this code is that when you create a single word, it will not be line separated even though it is at the end of the line or the size of the web browser is reduced. In addition, the code can also be replaced with . Both codes have the same meaning and function.
The second way to create spaces in HTML is to use the code . Then, what’s the difference with the first way? The code only gives a space between words as much as 1 space while the code can provide a distance between words as much as 2 spaces at once. So, you don’t need to type the code 2 times if you want to give 2 spaces, you only need to type the code once.
The following is an example of using a script or code
And the following results will be displayed.
The first and second lines in the image have the same spacing between words even though they use two different HTML codes. This illustrates the difference in the use of the two HTML space codes.
The next way to create spaces in HTML is to use code . If the code has a value equal to one space and the code has a value equal to two spaces, then there is also a space code in HTML that has a value more than that. Using then will make the distance between words equal to four spaces.
The use of code will certainly greatly summarize the use of code in HTML. To make the distance between words wider, you just need to type one code without having to type it repeatedly. The following is an example of the use of .
The following is the result of the code above.
To see the difference in the spacing of each code, please type the code below.
Below is the display result of the code above.
It is clear that the distance difference between the three methods is clear. What you need to remember is that the code can affect the truncation of each line, but the code or not will affect the truncation of the line.
4. Using Word Spacing
In addition to the three methods above, there are other ways that you can use to set the space in HTML with a space value that you can set yourself. This code can set the distance between words in each paragraph with the same value between words.
This method uses CSS code. Here is an example of using this code:
The code above makes the space between words 1em or 1 space. Below is a display of the code above.
To set the size you can use em or it can also be px or percent. Below is a comparison example of using the code above to create spaces in HTML:
And this is the result of the above code.
So this article discusses how to make spaces in HTML very easily. You can choose from the four methods above according to your needs. Hopefully this article can be helpful and useful for you. Thank you