title: How are multiple spaces showing in HTML, without pre, nbsp or white-space: pre?
body: <p>I'm sure this shouldn't be possible. Somehow, multiple spaces within paragraphs in my HTML markup aren't collapsing. They are <strong>not</strong> <code>&amp;nbsp;</code>, <strong>not</strong> in a <code>&lt;pre&gt;</code> tag, <strong>not</strong> set to <code>white-space: pre-wrap;</code> or <code>white-space: pre;</code> and the behaviour is <strong>not</strong> changed by forcing <code>style="white-space: normal;"</code> on the element.</p>
  
  <p>My understanding is, that these are the only three ways that whitespace can be preserved and that two or more spaces can be made to show up in HTML.</p>
  
  <p>So the question is: What else could cause sequential whitespace to show up as multiple spaces? There must be something else - but I can't look for it until I know what it is, and every source I find just talks about <code>&amp;nbsp;</code>, <code>&lt;pre&gt;</code> and <code>white-space: pre-wrap;</code> or <code>white-space: pre;</code></p>
  
  <p><strong>Key edit:</strong> Using Firebug I tried deleting some of the offending whitespace and typing it back in again. When deleted and re-entered from the keyboard, the spaces behave as normal - no unexpected whitespace in the browser. So it <em>must</em> be some character that shows up in view source, text editors, etc as a plain space, but actually behaves like <code>&amp;nbsp;</code>. What can it be, and crucially, how can I identify it to remove it? The original source of the offending input is the wysiwyg editor TinyMCE so I'm adding that tag...</p>
  
  <hr>
  
  <p><strong>More detail:</strong> I have some HTML containing paragraph text that includes multiple spaces, like this (between the ...s is copied direct from Firefox view source):</p>
  
  <pre><code>&lt;p&gt; blah blah.... nothing  more  than  a ... blah blah &lt;/p&gt;
  </code></pre>
  
  <p>As you can see, <strong>these are regular spaces, not</strong> <code>&amp;nbsp;</code>. The document has <code>&amp;nbsp;</code> elsewhere and they show up as such in view source, so they're not <code>&amp;nbsp;</code>s somehow masquerading as normal spaces in the source.</p>
  
  <p>Also, <strong>the CSS is <em>not</em> set to</strong> <code>white-space: pre;</code> or anything like that:</p>
  
  <ul>
  <li>Firebug's 'Computed' panel lists no whitespace related rules.</li>
  <li>Forcing a <code>white-space: normal;</code> on the paragraph makes no difference to the spaces. The rule does show up in the Firebug 'Computed' panel, so it is applying.</li>
  <li>Applying <code>white-space: pre-wrap;</code> to the paragraph results in other changes, but doesn't change these multiple sequencial spaces. For example, it makes an extra space visible at the end of each line break within a paragraph of selected text. So it's definitely not somehow being stealthily set to <code>white-space: pre-wrap;</code></li>
  </ul>
  
  <p><strong>There are no</strong> <code>&lt;pre&gt;</code> <strong>tags</strong> in the document, anywhere. Find on <code>&lt;pre</code> in the source finds nothing.</p>
  
  <p>So it should therefore show in the browser with one space between each word. It  doesn't. It shows multiple spaces as if it was <code>&lt;pre&gt;</code> or <code>&amp;nbsp;</code> or  <code>white-space: pre;</code>. But it isn't any of these.</p>
  
  <p>There <em>must</em> be some other way of getting a  <code>white-space: pre;</code> like effect I don't know about. What other ways to preformat whitespace and stop multiple spaces collapsing are there? What could possibly be causing this.</p>
  
  <hr>
  
  <p>A few background notes:</p>
  
  <ul>
  <li><strong>Seen in which browsers?</strong> Firefox 16.0.2, Google Chrome 23.0.1271.95 m (Windows)</li>
  <li><strong>Why is there double spaced whitespace in the markup if you don't want it visible?</strong> I'm working on the front end / design for a CMS where the users will be inputting text from Word and PDFs via TinyMCE wysiwyg (non-negotiable). Therefore, the markup will be messy. Fixing the CMS text formatter to scrub whitespace and clean the markup is outside the scope of this work.</li>
  <li><strong>Doctype?</strong> <code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML+RDFa 1.1//EN"&gt;</code></li>
  <li><strong>You're sure there are multiple spaces?</strong> Definitely, you can select one, two, in some cases three spaces between words in the browser front-end.</li>
  <li><strong>Can I seez all teh codez?</strong> Sorry, but it's a pre-launch site, it's not publicly available. Feel free to ask about specific CSS rules, HTML tags, javascript stuff loaded etc etc.</li>
  </ul>