Two snowmen on a Winter's day. One says to the other, "Can you smell carrot?"

Beginner's Guide to XHTML

Wednesday 22nd June 2005 - Saturday 7th January 2006

Categories: Guides, Internet, Code

Special Characters

When writing in XHTML, there are various characters that are not in the normal character set. There are also characters that are using in writing XHTML, and so cannot be displayed as you would a normal character. For these characters, you must use a character entity. The table below shows some of the special characters you may use. Of particular note is the ampersand. You must use the character code for it not only in normal text, but when defining a link.

Character code Result
" or " "
& or & &
&lt; or &#60; <
&gt; or &#62; >
&nbsp; or &#160; Non breaking space
&iexcl; or &#161; ¡
&cent; or &#162; ¢
&pound; or &#163; £
&curren; or &#164; ¤
&yen; or &#165; ¥
&brvbar; or &#166; ¦
&sect; or &#167; §
&copy; or &#169; ©
&reg; or &#174; ®
&plusmn; or &#177; ±
&sup2; or &#178; ²
&sup3; or &#179; ³
&frac14; or &#188; ¼
&frac12; or &#189; ½
&frac34; or &#190; ¾
&times; or &#215; ×
&divide; or &#247; ÷

For a fuller list of characters, you can look at the reference on the World Wide Web Consortium's Website. Here is an example of how to use the table:

<!ENTITY uml CDATA "&#168;" -- diaeresis = spacing diaeresis, U+00A8 ISOdia -->

The part after ENTITY tells you the first way you can write the character, in this case &uml;. The part after CDATA tells you the second way you can write the charater, in this case &#168;. The final part is a description of the character.

Useful Links