Display multiple spaces in a HTML Page
By default, the multiple spaces between words in HTML page will be displayed as single space in browsers.
Sometimes, we will require to display text from database that has multiple space between words which needs to be maintained when we display in the page. For example, binding a text inside div with multiple spaces. To display the given number of spaces between the words in HTML we can follow any one of the technique that is discussed here.
Replace a space with
This is one way to display multiple spaces inside a DIV tag. Before setting the text to DIV tag replace all spaces with
<div>I Love Dotnet</div>
Use PRE tag
Another way of displaying multiple space inside div tag is wraping the text inside <pre> tag.
<div><PRE>I Love Dotnet</PRE></div>
|