Why do browsers render as a regular space character?
Consider the following HTML snippet:
<p>Space Test</p>
When this HTML is used in a web page and the page rendered by a browser, the character actually rendered by the browser between "Space" and "Test" is a regular space character (U+0020), not a non-breaking space character (U+00A0).
(This can be observed by, for example, using the Firefox extension Character Identifier.)
I tried this in Firefox 5, I开发者_JAVA技巧nternet Explorer 8, and Chrome 12; all had the same behavior of writing out U+0020 instead of U+00A0 on the rendered web page, even though though the source document contained
rather than a regular space character.
Why do browsers render a regular space character instead of a non-breaking space character in this way?
This is a relic of pre-Unicode times, when the NBSP character didn't exist in the standard character set. HTML defined the
escape sequence as simply a space that shouldn't cause word wrapping.
精彩评论