Thursday, 17 March 2011

Non-breaking Space in HTML

  is the entity used to represent a non-breaking space. It is essentially a standard space, the primary difference is a browser will not not break (or wrap) a line of text at the point that this  occupies.

You can use the non-breaking space to indent text and images a small amount. It's not a good idea to use a lot in a row, as older browsers don't support more than one at a time.

The Single Pixel GIF Trick

This uses a transparent GIF image that is 1 pixel square. You take that image and stretch it out to force your HTML to lay the way you want it to. For example:

<p><img src="spacer.gif" alt=" " width="1" height="1" style="margin-right: 5px; margin-left: 5px;" />This paragraph is indented 11 pixels.</p>

No comments:

Post a Comment