CODEDIGEST InstallShield
Home Articles CodeDigest Tutorials InstallShield FAQs
Skip Navigation LinksHome » CodeDigest » Display multiple spaces in HTML   You are not logged in.
Search
 

Sponsors
InstallShield
 

Sponsored Links
 

Technologies
 

CodeDigest Navigation
 

Technology News
No News Feeds available at this time.
 

Community News
No News Feeds available at this time.
 
Display multiple spaces in HTML
Display multiple spaces in HTML
Submitted By Satheesh Babu
On 1/9/2009 10:33:49 AM
Tags: CodeDigest,DIV,HTML  

Display multiple spaces in HTML

 

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!!