2

In HTML, this:

<p>Hel     lo</p>

is the same as:

<p>Hel lo</p>

and this:

<p>Hel



 lo</p>

is the same as:

<p>Hel

lo</p>

What was the design reasoning for this?

BoltClock
  • 700,868
  • 160
  • 1,392
  • 1,356
  • 1
    You can design your text, using `
    ` tag.
    –  Aug 02 '17 at 04:02
  • Thank you, I'm aware. I'm just wondering about the design decision for this not being the default behaviour. –  Aug 02 '17 at 04:06
  • If not, then you can't format your code and can't have it with your set of spaces and tabs. A similar question here https://stackoverflow.com/questions/433493/why-do-multiple-spaces-in-an-html-file-show-up-as-single-spaces-in-the-browser – karthikdivi Aug 02 '17 at 04:12
  • I moved my answer to the duplicate question: https://stackoverflow.com/questions/433493/why-do-multiple-spaces-in-an-html-file-show-up-as-single-spaces-in-the-browser/45451580#45451580 – BoltClock Aug 02 '17 at 04:39

1 Answers1

0

Multiple spaces normally created by the space, the tab key and return key are all ignored when you write code. HTML just interprets them all as whitespace between words, and displays a single space.

You still can add whitespace by insert a non-breaking space like &nbsp; or &#160.

Obsidian Age
  • 41,205
  • 10
  • 48
  • 71
Scott
  • 1