Using Numeric Character References
At some point when working with HTML, you will come across special character sets and symbols that are supported in the markup. The most extensive character set, “Unicode”, covers symbols for every spoken language in the world and is comprised of close to 70,000 different symbols and characters. A more compressed version of Unicode is “UTF-8” which is most likely the default character set on your browser. UTF-8 supports two different methods of HTML syntax; numeric character references and character entity references. In this tutorial, we will discuss numeric character references.
What are Numeric Character References?
A numeric character reference is a format type for an HTML symbol. The symbol or character is expressed in HTML in four distinct parts:
- The opening
- The number sign
- The numeric reference
- The closing
For example, to display a copyright symbol in the browser, you would enter “©”. The ampersand (&) opens the tag, the pound symbol (#) initiates the numeric character, the numeric character (169) references the symbol, and the semicolon (;) closes the tag.
The following HTML code gives a few examples of some of the most commonly used symbols written in HTML as numeric character references:
<br /><br />
<h2 style="text-align: center;">These are Examples of Some Common Numeric Character References</h2>
<br /><br />
<br /><br />
<p style="text-align: center;">Copyright symbol: ©</p>
<p style="text-align: center;">Ampersand symbol: & </p>
<p style="text-align: center;">Dollar Sign: $ </p>
<p style="text-align: center;">Percent Sign: % </p>
<p style="text-align: center;">TradeMark Symbol: ™ </p>
<p style="text-align: center;">Registered Trademark Symbol: ® </p>
<h3 style="text-align: center;">Open the source code for this document to view the syntax for these symbols.</h3>
If you open the source file, or copy and paste the provided code and save as an HTML document, you can see the special symbols rendered in the browser in the following image :
Although numeric character references are not as simple to work with as character entity references, there is a much broader selection of symbols and characters available to work with. This is due largely in part to the way the syntax is structured, and the simple fact that numeric combinations are able to express any number of characters.
A Few Last Words…
There are hundreds of symbols and special characters that you can apply to your page. Some of course need to be looked up or kept on a nice little chart because in reality, memorizing all the numeric values may become overwhelming and time consuming. Join us next time for additional HTML tutorials!
Download Source Files