Browsers treat consecutive multiple spaces and new lines as a single white space.


If multiple spaces or new lines are added the browser will ignore them and simply treat as a single space.


This is known as whitespace collapsing.


If more than one space is required between two words a non-breaking space should be used  


Similarly, if further new lines are required between content, a <br> element should be used.


<!DOCTYPE html>
		<title>My Document Title</title>
		<h1>My       first Heading</h1>

		<h1>My &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; second heading</h1>
		<p>Paragraph one</p>
		<p>Paragraph two</p>
		<p>Paragraph three</p>

Save & refresh browser:

My first Heading

My            second heading





Paragraph one

Paragraph two

Paragraph three

Leave a Reply