Home > Articles

Adding Text and More

  • Print
  • + Share This
This chapter is from the book

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

<

&lt;

less than

>

&gt;

greater than

"

&copy;

copyright

&reg;

registered trademark

±

&plusmin;

plus or minus

2

&sup2;

superscript 2

3

&sup3;

superscript 3

´

&acute;

acute accent

´

&#96;

grave accent

#

&#35;

number

%

&#37;

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, &amp; for the ampersand and &gt; 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: &nbsp;. 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 &nbsp; character.

  • + Share This
  • 🔖 Save To Your Account