Patterns of Chaos

Special Characters

In the last lesson, we used the symbol for PI (π). You'll also notice the double arrows on the links at the bottom of the page. Those aren't characters you can type, so how do you get them?

HTML supports a bunch of special characters. Some of them you should use in place of regular characters that have special meanings, like the ampersand (&), greater or less than (> <), or quotes ("). Others are used for characters that you simply can't type, like copyright (©) or trademark (™), or pi.

When using a special character, you begin with an ampersand (&) and end with a semicolon (;). What comes between the two tells which special character to render. So for pi, you enter &pi;, and the browser will render π

The ampersand is a reserved character for the browser - it tells the browser that there is a special character coming. So you shouldn't use ampersands in your text. Instead, if you want an ampersand, you should use the HTML code for it: &amp;

The others mentioned on this page are greater than (&gt;), less than (&lt;), quote (&quot;), copyright (&copy;), and trademark (&trade;). The double arrows used in the links are &raquo; and &laquo;.

These special characters starting with the & are called HTML Entities. To see all the possible entities you can use, check out this list, or see the Wikipedia page.