Tell a Friend About Our Cool Software

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
< < less than
> > greater than
& & ampersand
" " double quote
Here's an example: here's some HTML code:
<p>The new product name is "Nice & Tasty&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 . Each one of these is
displayed as a space and is never collapsed. For instance:
<p>Total cost:
$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 | £ |
| ¥ | Yen symbol | ¥ |
| ¢ | Cent symbol | ¢ |
| © | Copyright symbol | Ä |
| ® | Registered trademark | ® |