title: Why does the browser renders a newline as space?
body: <p>For the longest time, I have wanted to understand why the browser adds an empty space between rendered HTML elements when there is a NewLine between them, for example:</p>
  
  <pre><code>&lt;span&gt;Hello&lt;/span&gt;&lt;span&gt;World&lt;/span&gt;
  </code></pre>
  
  <p>The html above will output the “HelloWorld” string <strong>without</strong> a space between “Hello” and “World”, however in the following example:</p>
  
  <pre><code>&lt;span&gt;Hello&lt;/span&gt;
  &lt;span&gt;World&lt;/span&gt;
  </code></pre>
  
  <p>The html above will output a “Hello World” string <strong>with</strong> a space between “Hello” and “World”.</p>
  
  <p>Now, I have no problem accepting that this is just the way it works period, but the thing that bugs me a little is that I was always under the impression that spaces (or newlines) between the html elements would not matter at the time when the browser rendered the html to the user.</p>
  
  <p>So my question is if anyone knows what the philosophical or technical reason behind this behavior.</p>
  
  <p>Thank you.</p>