Home‎ > ‎ICT Programming‎ > ‎Assignments Fall 2012‎ > ‎

HTML - Indenting & Symbols

posted Oct 2, 2012, 7:59 AM by Jon Hamlin   [ updated Sep 15, 2013, 7:07 PM ]

INDENTING A LINE and CREATING SPACES with  

 Notice that I indented the beginning of this paragraph. Remember that your browser normally prints text left justified and only leaves one space between words and sentences. To force extra spaces or simply to indent a line, use the following command. It works.

 

        These six characters will create a space as if you pressed the space bar. I used 8 of them to indent this paragraph as in:

        These six characters will ...

In &nbsp;, the nbsp stands for non-breaking space character. &nbsp; is simply known as the space character. How many of these non-breaking space characters you use in a row is up to you. Use whatever number suits your purpose. Note that the "nbsp" must be inlower case letters. &NBSP; will not work. The character "&" is pronounced "ampersand" and these 6 characters form an ampersand command. We know that browsers read commands inside angle brackets (<    >). Well, browsers also read commands between the "&" and ";" (that is, between the ampersand and semicolon). Ampersand commands are used to create special characters not found on the keyboard such as the copyright symbol, the trademark symbol, the symbol for degrees, etc. All you need to know is that special code that goes between the "&" and the ";".

Here are some popular symbols and their ampersand commands that work in all browsers (commands for subscripts and superscripts are covered in Lesson 17):

Non-breaking space &nbsp;
Copyright©&copy;
Trademark&#153;
Registered®&reg; or &#174;
Less Than<&lt;
Greater Than>&gt;
Ampersand&&amp;
Quote"&quot;
Apostrophe'&#39;
Cent¢&#162;
Euro&euro; or &#8364;
One quarter¼&#188;
One half½&#189;
Three quarters¾&#190;
Degrees°&#176;
Larger middle dot&#149;

If all you want to do is indent a line or paragraph, using the ampersand command is quite simple. But the ampersand command can also be cumbersome to work with. For example, try the following first problem for this lesson.

Problem 1:SWITCH to NOTEPAD and make up an HTML document that gives the following output in your browser. Indent my address 10 spaces (10 &nbsp; commands) from the left side of the screen, and use 30 spaces between the "n" in Hamlin and the "W" in William. Do the best you can to line everything up. The answer is given in the answer section at the end of this lesson

           Mr. Hamlin                              William Somebody
           Pinetree Secondary                  120 Somestreet
           3000 Pinewood Ave                Someplace, Somestate
           Coquitlam, BC                         U.S.A. 45061
           Canada, V3B 7Y7



Continue to HTML Tables

Comments