Div is not showing multiple white spaces in between strings
For Example:
This string 'New Folder'
I would like to be displayed as 'New Folder'
Creating extra spaces before or after text To create extra spaces before, after, or in-between your text, use the (non-breaking space) extended HTML character. For example, with the phrasing "extra space" using a double space, we have the following code in our HTML.
The source of the problem is that HTML compresses all space characters—tabs, spaces, and carriage returns—to one character. If you want to indent your paragraphs, you can't simply type five spaces and then begin the text.
The simplest way to add a space in HTML (besides hitting the spacebar) is with the non-breaking space entity, written as or  . Multiple adjacent non-breaking spaces won't be collapsed by the browser, letting you “force” several visible spaces between words or other page elements.
If you want to prevent the text from wrapping, you can apply white-space: nowrap; Notice in HTML code example at the top of this article, there are actually two line breaks, one before the line of text and one after, which allow the text to be on its own line (in the code).
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With