Special Characters
You might find that you sometimes need to use symbols on your Web pages. Symbols (such as +, , %, and &) are used frequently in our everyday writing, so it's easy to understand that they would appear on a Web page as well. Unfortunately, not all Web browsers display these symbols correctly. HTML uses a little computer shorthand, either using a numerical code or a text code (called an entity character reference) to tell the browser how to interpret these symbols. Table 3.1 shows some of the most frequently used codes.
Table 3.1 Special Character Codes
Char |
Code |
Description |
& |
& |
ampersand |
< |
< |
less than |
> |
> |
greater than |
" |
© |
copyright |
‚ |
® |
registered trademark |
± |
&plusmin; |
plus or minus |
2 |
² |
superscript 2 |
3 |
³ |
superscript 3 |
´ |
´ |
acute accent |
´ |
` |
grave accent |
# |
# |
number |
% |
% |
percent |
The W3C's Web site contains a complete list of the characters supported by HTML. You can see how many of these symbols are easy to understand (for example, & for the ampersand and > for the greater than symbol). Some of the characters, such as number and percent, require that you memorize numbered codes. Yuck. The best thing you can do is to make sure that you preview your Web pages in a variety of browsers before publishing them.
Tip
Here's a special character that you should remember: . The symbol' stands for nonbreaking space and is used to insert a space inside an HTML document. Because HTML ignores extra spaces between words and tags, you need to have a way of including an extra space. You can do that with the character.