Ryan's District
November 22, 2008, 05:53:09 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: You are not allowed to view links.
Register or Login
How to Unlock Nokia mobile Phones

You are not allowed to view links.
Register or Login
Request any TV Show / series / Episodes / movie and we will get it for you for free

 
   Home   Help Search Chat Calendar Chess Shop Login Register  
Digg This!
Pages: [1]   Go Down
  Send this topic  |  Print  
Author Topic: HTML - Introducing spaces and new lines with character entities  (Read 3965 times)
0 Members and 2 Guests are viewing this topic.
ben2ong2
Quality Poster
Paid
Hero Member
*****

Reputation: 17
Offline Offline

Gender: Male
Posts: 2374
9976.80 RD$

View Inventory
Send Money to ben2ong2

View Profile Awards
« on: October 03, 2006, 05:19:37 PM »

When displaying the web page, browsers collapse and ignore, spaces, tabs and new line characters in the HTML. You might have spent a lot of time formatting a document using spaces only to be surprised at its display in a browser. Let us check this out.

This contains          ten space characters.
A new line character has been inserted.
      And here are 2 tabs before this line.
is displayed in the browser as:

This contains ten space characters. A new line character has been inserted. And here are 2 tabs before this line.

You'll notice that the 10 spaces, new lines and tabs that were visible in the code above are not shown by the browser, though you will find them in the source code (VIEW-SOURCE or PAGE SOURCE).

The only HTML tag that preserves such characters is <PRE> and I have used consistently for code display (as above), but <PRE> renders the font as fixedspaced!

Web developers employ various tricks to achieve indentation and introduce spaces in their documents. They use list tags - <OL>, <UL> and <LI> - or <BLOCKQUOTE>. This is not advisable as HTML has a special character for introducing spaces, &nbsp; (lowercase).

Placing 8 &nbsp; will display equivalent number of space characters

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;8
          8



If you're wondering what nbsp; means; it stands for non-breaking space character. The &nbsp; is a character entity. You can find a thorough list of character entities here.

For introducing new lines, use <BR> tag.

Logged

You are not allowed to view links.
Register or Login
Free Paid Survey & Home Business Resources.

You are not allowed to view links.
Register or Login
Free Article Directory | Quality Content
Ryan's District
« on: October 03, 2006, 05:19:37 PM »

 Logged
Pages: [1]   Go Up
  Send this topic  |  Print  
 
Jump to:  

Archive - WAP2 - WAP - imode
Sponsors: RAYAN.tv
-

Powered by MySQL Powered by PHP Powered by SMF 1.1.7 | SMF © 2006-2008, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 0.197 seconds with 31 queries.

Google visited last this page Today at 08:19:46 AM