That is how html works. Whitespace is collapsed. Look at the way your question is displayed to see an example.
To work around this, wrap your text in a <pre> tag, or use instead of space characters
Or add white-space:pre to the CSS for the div.