Spaces

HTML does not recognize more than one space character entered in a row within a line of text.  What this means is that when you hit the space key, as long it is between two other standard characters, such as the spaces in this sentence, HTML recognizes that the space exists and browsers leave a space in the display. However, HTML does not recognize two or more space characters next to each other. This is interpretted the same way as a single space.

So to allow more spaces to exist in the display, a character entity called the non-breaking space is used.  This is written as “&nbsp” and instructs the browser to leave as many spaces as there are &nbsp instructions in the code.

Since this is not an actual character but a code which stands for a character, the browsers get to handle this however they like. That does not always match up with what you expect to see!

First, the &nbsp character is dependant on browser font settings.  What this means is that if you use space characters to attempt to indent elements, you will get varying results as each browser can interpret these spaces at different sizes.

Second, the &nbsp is handled differently in tables in different browsers.  This has to do with what is called “text wrap” which is where a text area recognizes that a limit has been reached in a text area and wraps elements to the next line. Since teh &nbsp is not a real character but a code, different browsers wrap a string of these characters at different points resulting differing line spacing as well as differing table widths as the browsers alter their display to accommodate the coded characters.

Follow the link below to see some practical demonstrations of space characters.

Go Back to Previous Page

Have a question that you can´t find the answer to? Want to report a possible bug?

Send a help request to NetObjects Technical Support