JavaScript Tutorial JavaScript Examples JQuery Tutorial CSS Tutorial HTML Tutorial About Us

Lesson 12: Using Character Entity References


Basically, we can create a webpage using HTML elements. However, certain characters cannot be typed directly into an HTML document they are reserved for use as HTML elements. The most obvious examples are the > and < signs, they are reserved for the start tags and end tags of the HTML elements.  To overcome the issue, HTML provides character entity reference in the form of &code;. For example, to show the > sign on the webpage, we use &lt;  and for  the & sign, we use &amp;

The following table shows a list of characters and the respective HTML encoding.

Character HTML code
> &gt;
< &lt;
&le;
&ge;
& &amp;
 spacing &nbsp;
½ &frac12;
¼ &frac14;
© &#169;
® &#174;
» &#187;
Ç &#199;
À &#192;
&#8482;
È &#200;
â &#226;
ß &#223;
Ģ &#290;
÷ &#247;
&#9776;
&#8801;
Example
< pre>If volume &gt; 100,000 and Price &lt; $50,000 then buy more.
 However, if volume &le;50,000, then stop trading.
 The earnings at volume=100000 is &frac14; of the total sales.
 HTML Tutorial &#174;is a registered trademark.
 The above article is &#169; Dr.Liew &amp; Associates
</pre>

The output is shown below:

If volume > 100,000 and Price < $50,000 then buy more.
However, if volume ≤50,000, then stop trading.
The earnings at volume=100000 is ¼ of the total sales.
HTML Tutorial® is a registered trademark.
The above article is © Dr.Liew & Associates




Copyright©2008 Dr.Liew Voon Kiong. All rights reserved |Contact|Privacy Policy