ComputersProgramming

How to put a space html

If you are developing html-files, you probably noticed this feature when the browser ignores spaces. In the source code, there can be an unlimited number of them, but only one is visible as a result. Most often, this restriction only positively affects the output of information. After all, sometimes you can put a few spaces at random, as a result, the document turns out to be unordered. And with the help of restriction the distance between words will always be fixed. But sometimes there is a need to make a double or triple space, html will allow you to make unlimited distance between words at your discretion. Implement this need in several ways, which we'll talk about in this article.

The first way

When there is a need to make a longer distance between certain words, you can use a special html space code. It's enough to add the "& nbsp" entry, which will increase the distance between the characters. Such code can be used as a normal blank, only with the exception that it will always be taken into account when displaying information by the browser. This special html space is sometimes used to emulate a red line or select a separate text fragment. It is necessary to tell a little about the code itself. The first character is an ampersand. It denotes the action of a special code. In html there are many other combinations that give different effects. For example, "& gt" and "& gl" replace the signs "<" and ">". Their use is necessary, since they denote the beginning and end of the tag. In this case, "nbsp" means the abbreviated form of the command "non-breaking space", which in translation means " non-breaking space ". There is a numerical value for this command. The name "& # 160", which completely repeats the effect of this gap. It is worth noting the fact that if there is a "& nbsp" code between words, they will always be on one line. If they go beyond the screen, a scrollbar appears in the browser. The code "& nbsp" is a full emulation of the usual blank.

The second way

The second method is used for more ambitious purposes. A space in html can be set using the

 tag. It allows you to output text without additional formatting. If the information is placed in this tag, it will be presented in the original form as in the html-code of the page. It takes into account not only spaces, but also line breaks. But it's worth noting that, as with the "& nbsp" code, the text enclosed in the 
 tag will appear on one line if there is no natural translation. There is one more remark. All that is between the opening and, respectively, the closing 
 tag, will have a specific font  . 

The third way

This method can not be called new, because it simply offers an alternative to the second. Using cascading style sheets, you can achieve the same effect as the

 tag. But the font will remain unchanged. The "white-space" rule with the value "pre" fully emulates the html space using the previously described tag. This command can be applied to any area of text. 

Conclusion

The above methods will help you put a multiple blank. HTML thus makes it very flexible and, at its discretion, to customize its pages. But, as practice shows, it is rare to use a multiple space.

Similar articles

 

 

 

 

Trending Now

 

 

 

 

Newest

Copyright © 2018 en.delachieve.com. Theme powered by WordPress.