October 22, 2011

Non-breaking space,  

&nbsp; stands for non-breaking space character or simply known as space character. It should be typed in lower case letters. Just like the angle brackets (<, >), browsers also read commands between ampersand “&” and “;”. Let us see the effect of non-breaking space tag on your webpage by typing in the code below on your text editor.

<html>
<head><title>nbsp</title></head>
<body>

<p>          I am a paragraph and I am not 
indented eventhough I hit the space bar 10 times.</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp; I am a paragraph and I am indented by 10
 character spaces using non breaking space tag.</p>

</body>
</html>

The code above will be displayed like this in Mozilla Firefox.
click to enlarge

Based on what you have observed in your web browser, what is the effect of &amp;nbsp;  to the texts placed after it?

0 comments: