CODEDIGEST
Home » CodeDigest
Search
 

Technologies
 

Display multiple spaces in HTML
Submitted By Satheesh Babu B
On 1/9/2009 10:33:49 AM
Tags: CodeDigest,DIV,HTML  

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&nbsp;&nbsp;Love&nbsp;&nbsp;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>

 

 

Do you have a working code that can be used by anyone? Submit it here. It may help someone in the community!!

Recent Codes
  • View All Codes..