Appendix F. Special Characters

Some characters are reserved in XHTML; for example, you cannot use the greater-than and less-than signs or angle brackets within your text because the browser could mistake them for markup. XHTML processors must support the five special characters listed in the table that follows.

Symbol

Description

Entity Name

Number Code

&

Ampersand

&

&

<

Less than

&lt;

&#60;

>

Greater than

&gt;

&#62;

"

Double quote

&quot;

&#34;

 

Non-breaking space

&nbsp;

&#160;

To write an element and attribute into your page so that the code is shown to the user rather than being processed by the browser (for example, as <div id="character">), you would write:

&lt;div id=&quot;character&quot;&gt;

There is also a long list of special characters that HTML 4.0-aware processors should support. In order for these to appear in your document, you can use either the numerical code or the entity name. For example, to insert a copyright symbol you can use either of the following:

&copy; 2008
&#169; 2008

The special characters have been split into the following sections:

  • Character Entity References for ISO 8859-1 Characters

  • Character Entity References for Symbols, Mathematical Symbols, and Greek Letters

  • Character Entity References for Markup-Significant and Internationalization Characters

They are taken from the W3C website at www.w3.org/TR/REC-html40/sgml/entities.html.

Character Entity References for ISO 8859-1 Characters

Symbol

Description

Entity Name

Number Code

 

No-break space = non-breaking space

&nbsp;

&#160;

¡

Inverted ...

Get Beginning HTML, XHTML, CSS, and JavaScript® now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.