Login for Software or Support

CoffeeCup - HTML Editor, Flash & Web Design Software

Over 47,729,277 Downloads in 87 Countries

Tell a Friend About Our Cool Software

Buy the Book Here !

Chapter 2: Special Characters


Certain characters have special meaning in HTML, such as the < and > characters that are used to enclose tags. This means that you can't just go ahead and use these characters in your content, but must use a special code to represent them. These are called character entities and they are represented by a letter or number code preceded by an ampersand and followed by a semicolon. For example, < is the code for the "less than" symbol (<). Here are a few commonly used character entities:

Code Character
&lt;         <    less than
&gt;        >    greater than
&amp;    &    ampersand
&quot;    "    double quote
Here's an example: here's some HTML code:

<p>The new product name is &quot;Nice &amp; Tasty&amp;quot;</p>

And here's how it will be rendered by a browser:

The new product name is "Nice & Tasty"

Another character entity that is commonly used is the non-breaking space. You'll recall from the section on white space earlier in this chapter that HTML's default behavior is to normalize white space in a document, collapsing multiple spaces, tabs, or new lines to a single space. But what if you actually want multiple spaces in the document? Then you must use the non-breaking space character entity &nbsp;. Each one of these is displayed as a space and is never collapsed. For instance:

<p>Total cost:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $15.95</p> is rendered like this:

Total cost: $15.95

Finally, there are character entities for special characters that do not appear on most keyboards, such as the cent symbol and the accented
letters that are used in many European languages. There are many dozens of these; the few that you are most likely to use are listed in Table 2-1 (see the back of the book for a more complete list)

Table 2-1. Character entities for non-keyboard characters.

Character Name Entity
£ Pound sterling symbol &#163;
¥ Yen symbol &#165;
¢ Cent symbol &#162;
© Copyright symbol &#196;
® Registered trademark &#174;


Table of Contents
Download Our Software:

... and don't forget about our Free Software

CoffeeCup Home Page | Software | Copyright & Legal | Site Map | © 1996 - 2008 CoffeeCup Software, Inc.