Inserting Special Symbols and Characters  to your HTML

Photo by Shane on Unsplash

Inserting Special Symbols and Characters to your HTML

Using HTML entity names and numbers to add symbols

There are a limited number of keys a keyboard can contain, even with the introduction of a second function key, special signs and symbols were left out and may not even be noticed until you needed them.

Since you are here, you may be familiar with the concept of HTML. (Hypertext Markup Language) HTML: It is a standard markup language for web page creation. It allows the creation and structure of sections, paragraphs, and links using HTML elements (the building blocks of a web page) such as tags and attributes.

Since mathematical, statistical, technical and currency symbols are not available on the everyday standard keyboard, this becomes a problem when trying to include these unique symbols in your HTML code and there is no readily available quick-fix on your keyboard.

To add such symbols for example a copyright symbol, a Trademark symbol, or some form of mathematical or statistical symbol to your HTML page(s). You don't need to worry, this article got you covered. You can use the entity name or the entity number (a decimal or a hexadecimal reference) for the symbol.

In this article, you will be properly guided on how to use HTML entities on your webpage(s) with ease.

Earlier, we mentioned that symbols can be added using an entity name or an entity number (decimal or hexadecimal). We would be looking in detail at how to use HTML entity names and numbers.

Adding Symbols Using HTML Entity names.

A good example using HTML entity names is:

<!DOCTYPE html>
<html>
<body>

<h1>HTML Entity name Examples</h1>

<h2>The copyright symbol: &copy;</h2>
//displays the copyright sign
<h2>The gamma symbol: &Gamma;</h2>
//displays the mathematical symbol (gamma) sign
<h2>The euro symbol: &euro;</h2>
//displays the euro symbol
<h2>The heart symbol: &hearts</h2>
//displays the heart symbol
<h2>The downward arrow symbol: &darr;</h2>
//displays the downward arrow symbol


</body>
</html>

The piece of code above uses the HTML entity name and will display the copyright symbol, the gamma symbol(mathematical), the Euro sign(currency), and the heart symbol(from the card game) in the mentioned sequence. So you can use as many signs and symbols as you want on your webpage as long as you can get your hands on the encoded entity name. It is important to note that every HTML entity name starts with the ampersand character (“&”), it symbolizes the beginning of an entity reference (a special character) and ends with the semi-colon character(;). If you want one to appear in text on a web page you can use the encoded named entity.

We have earlier mentioned that symbols can also be added to your HTML page(s) using HTML entity numbers (using decimal or hexadecimal values). Now, we are going to talk about each of them in detail.

Adding Symbols Using HTML Entity numbers(with Decimal Values).

Some examples using HTML entity numbers(with decimal values) are :

<!DOCTYPE html>
<html>
<body>

<h1>HTML Entity number(decimal) Examples</h1>

<h2>The copyright symbol: &#169;</h2>
//displays the copyight sign
<h2>The gamma symbol: &#915;</h2>
//displays the mathematical symbol (gamma) sign
<h2>The euro symbol: &#8364;</h2>
//displays the euro symbol
<h2>The heart symbol: &#9829;</h2>
//displays the heart symbol
<h2>The downward arrow symbol: &#8595;</h2>
//displays the downward arrow symbol


</body>
</html>

The piece of code above uses the HTML entity number(decimal values) and will display the copyright symbol, the gamma symbol(mathematical), the Euro sign(currency), and the heart symbol(from the card game) in the mentioned sequence. Also, you can use as many signs and symbols as you want on your webpage as long as you can get your hands on the encoded entity number(decimal). Using decimal values, It is important to note that every HTML entity number(decimal) starts with the ampersand character (“&”), followed directly by the hash character("#") which symbolizes the beginning of an entity number(decimal) reference and ends with the semi-colon character(;). If you want one to appear in text on a web page you can use the encoded numbered(decimal) entity.

Adding Symbols Using HTML Entity numbers(with hexadecimal Values).

Again, symbols can be added using hexadecimal values. Some examples using HTML entity numbers(with hexadecimal values) are :

<!DOCTYPE html>
<html>
<body>

<h1>HTML Entity number(hexadecimal) Examples</h1>

<h2>The copyright symbol: &#xA9;</h2>
//displays the copyright sign
<h2>The gamma symbol: &#x393;</h2>
//displays the mathematical symbol (gamma) sign
<h2>The euro symbol: &#x20AC;</h2>
//displays the euro symbol
<h2>The heart symbol: &#x2665;</h2>
//displays the heart symbol
<h2>The downward arrow symbol: &#x2193;   </h2>
//displays the downward arrow symbol


</body>
</html>

The piece of code above uses the HTML entity number(hexadecimal values) and will display the copyright symbol, the gamma symbol(mathematical), the Euro sign(currency), and the heart symbol(from the card game) in the mentioned sequence. Also, you can use as many signs and symbols as you want on your webpage as long as you can get your hands on the encoded entity number(hexadecimal). Using decimal values, It is important to note that every HTML entity number(decimal) starts with the ampersand character (“&”), followed directly by the hash character("#") which symbolizes the beginning of an entity number(decimal) reference and ends with the semi-colon character(;). If you want one to appear in text on a web page you can use the encoded numbered(hexadecimal) entity.

To be able to differentiate between decimal and hexadecimal entity numbers, you should look out for the following. The hexadecimal values have an "x" character and of course, are made up of the hexadecimal system which includes letters of the alphabet. While the decimal values are made up of just numbers in the decimal system. It is important to note that they both start with the ampersand character ("&") directly followed by the hash character("#") and end with the semi-colon character(";").

CONCLUSION

It has been quite a ride. Congratulations on making it this far! We were able to give several detailed procedures with pictorial representation to visually aid us to help add special symbols and characters(mathematical, statistical, currency, arrow keys, the list goes on) to your HTML page(s) using HTML entity names or numbers(decimal or hexadecimal). At this point, you should be able to use any of your preferred methods to add symbols and characters. There are tons of special symbols and their HTML entity name or number can be found on third party-websites like click me. Grab as many entity names or numbers as you want and use them as needed!