Output protected spaces in HTML: Here's how
A non-breaking space in HTML prevents two words or characters from being torn apart when a line breaks. It is also possible to use more than one space in a row.
Non-breaking space in HTML
No matter how many spaces you insert, HTML always outputs only one space. This is often very impractical because more distance to an element is required. You could also use the non-breaking space for this.
- In HTML, the non-breaking space is a so-called NBSP tag. That stands for "non-breaking space", a space that cannot be separated.
- With the command "" (without quotation marks) you can save several words from a line break as well as insert several spaces in a row.
- Just add "" as many times as you want where you want to insert the non-breaking space.
In the next practical tip we will show further codes for text formatting in HTML.