Sunday, August 23, 2009
HTML: non-breaking space and its applications
A frequent complaint of bloggers is that when they want more than 1 spacing (beyond the single space inserted by the space bar like between here and here), Blogger will display only 1 single space irrespective of how many times one press the space bar. Now how did I get the extra spaces above within the bracket above?
The answer is simple. Where I want a space, I type . If I want more space, then all I have to do is to type in more .
A frequent use of non-breaking space is when making tables. For example, we may specify <table border="1"> to create a border for a table. However, if a cell is empty, the border for that cell may not be displayed. In order to force the table to display an empty cell with a border, one can type into the cell a so that it is "empty but not empty if you know what I mean" and will a blank cell with border.
Other uses of the non-breaking space is to make indent like in the beginning of this paragraph. The non-breaking space can also be used in comments as I will demonstrate by leaving a comment after I publish this post.