Special Characters

How do you say...

>>>Æ ñ Þóßÿ ?

NOTE: If the above characters do not display various accents or diacritical markers, then your web browser does not support the ISO character set. You would likely want to skip this lesson.

Objectives

After this lesson you will be able to:


Accent Marks

Sometime you may need to use a special character in an HTML document, an accent or diacritical mark. The ones that are known as ISO These special characters are marked in HTML as:


   &xxxx;

where XXXX is the code name for the special character. To create the special character for the German umlaut (ü), we need to use the HTML:


   ü

HTML Escape Sequences

The HTML for the accent mark is an example of the more general class of tags known as escape sequences. In entering HTML so far, you may have wondered what you do when you need to use a < (less-than) or a > (greater-than) sign? These two characters, plus the & (ampersand) have special meaning in HTML and cannot be used as typed. Instead, use the escape sequences:


   &lt;  is used for <
   &gt;  is used for > 
   &amp; is used for &

Extra Spaces

As you may have seen, a web browser will ignore all extraneous spaces in your HTML files. However, there may be times when you really want to have more than one space. When? Some writers like to have two spaces following the period at the end of the sentence. What if you wanted to indent the first sentence of every paragraph? How about having a single word with its individual letters spaced far apart?

An HTML code for adding a space character is the special character known as the "non-breaking space":

  &nbsp;

Here are some examples of how you might use the non-breaking space:

HTML Result
Two non-breaking spaces are used to spread the letters in a word farther apart

<b><tt>
C &nbsp; H &nbsp; E &nbsp; E &nbsp; 
S &nbsp; E
</tt></b>
sample web page
C   H   E   E   S   E
HTML Result
Two non-breaking spaces are used to indent the first sentence of each paragraph

&nbsp; &nbsp; When Sir Longhorn
had tragically died, no one was left to
carry on his tradition. 
There was much sadness 
in the land. 
And no cheese.
<p>
&nbsp; &nbsp; But then the young genius
Sheila Colby discovered the missing
ingredient. And once again, cheese 
was plentiful.
sample web page
    When Sir Longhorn had tragically died, no one was left to carry on his tradition. There was much sadness in the land. And no cheese.

    But then the young genius Sheila Colby discovered the missing ingredient. And once again, cheese was plentiful.

HTML Result
One extra space is used to add an extra space after the end of each sentence.

&nbsp; &nbsp; When Sir Longhorn
had tragically died, no one was left to
carry on his tradition. &nbsp; 
There was much sadness in 
the land. &nbsp; 
And no cheese.
<p>
&nbsp; &nbsp; But then the young genius
Sheila Colby discovered the missing
ingredient. &nbsp; And once again, cheese 
was plentiful.
sample web page
    When Sir Longhorn had tragically died, no one was left to carry on his tradition.   There was much sadness in the land.   And no cheese.

    But then the young genius Sheila Colby discovered the missing ingredient.   And once again, cheese was plentiful.

You may want to experiment with different ways to use the non-breaking space. At this time, we will not modify our HTML documents, but you may, if you wish, add the code for indenting each opening sentence of all paragraphs using two instances of the special code for the non-breaking space.

For more information on paragraph indentation, see Jim Barchuck's Stupid HTML Indent Tricks.


More Information

Here are some more special charcters that you may find useful:

Name HTML Result
Copyright
Trademark
Cent
Degree sign
double-less than
micron
Midline dot
Negation, continuation line
Paragraph
Plus/Minus
British Pound
double greater than
Section
Yen
&copy;
&reg;
&cent;
&deg;
&laquo;
&micro;
&middot;
&not;
&para;
&plusmn;
&pound;
&raquo;
&sect;
&yen;
©
®
¢
°
«
µ
·
¬

±
£
»
§
¥

See also the extensive list of special characters from WebMonkey.

Review

Review topics for this lesson:

  1. In HTML, what is the correct way to display a German umlaut (ü)?
  2. What happens if you do not use an escape sequence for < and >?
  3. Why would you need a special escape sequence for the & character?
  4. How can you indent paragraphs?