Print
08
May
2008

Non-breaking space

A 'non-breaking space' character is represented by the syntax

 

 

Unlike other empty spaces in HTML documents, the effects of non-breaking spaces are cumulative. While browsers weed out extra white space when rendering a page, all non-breaking spaces are rendered. Therefore normally if you entered more that two spaces before some text, the browser would truncate it to one space. Using the non-breaking space, you can force the document to display more space. For example to display 5 spaces before the word "Yellow":

      Yellow

 

Another difference between an NBSP and a normal space is that, when a string including the NBSP comes at the end of the line, and is too long to fit, it will move the whole string to the next line (including the strings that the NBSP connects to). This is analogous to how normal strings wrap. For example, the text "Mr. Smith" would normaly wrap on two lines if the text was at the end of a line ("Mr." remaining on one line, while "Smith" is pushed to the following). If you wanted to keep these together, you would change the code to:

Mr. Smith

Interested in building next-gen Big Data architecture? Join our webcast on 5/24 at 9am PT. Register here: http://t.co/k5Dsfskg

Oracle Oracle

#Oracle User Groups: Are You a Member Yet? Learn more about our 870 User Groups worldwide and become a member today: http://t.co/LsktPjH5

Oracle Oracle