HTML entities, what are they?

The content of a web page is structured using html tags. HTML syntax is made up of characters such as the "<" and ">". These characters, which are an integral part of the html syntax, are called reserved characters and must be encoded differently in html to be displayed correctly in the browser. Also, how to display characters that are difficult to enter on the keyboard such as the dollar sign, the euro sign or the mathematical symbols? I suggest you see in this article what HTML entities are and how to use them in html.

HTML entities are strings starting with ampersand "&" and ending with a semicolon ";". These strings are used to represent or display certain types of characters. It is a question of reserved characters that are part of the HTML syntax and therefore interpreted by the browser as being html code, invisible characters (like non-breaking space) or even certain types of characters that are difficult to type or simply non-existent on standard keyboards.

Suppose you want to code a simple paragraph displaying the following text: "The opening tag <footer> indicates the beginning of the footer". To display this paragraph without the part "<footer>" being interpreted as html code, replace the reserved characters "<" and ">" with their respective entities "&lt;" or "&#60;" and "&gt;" or “&#62;". So for the example above we will have the following code:

<p>The open tag &lt;footer&gt; indicates the start of the footer </p>

Also, mathematical and currency symbols can be difficult to enter on the keyboard. HTML entities provide a very easy way to display them. The division sign can be displayed on a web page using the string "&divide;" or "&#247;". Similarly, the euro and dollar symbols can be represented by "&#8364;" and "&#36;"

In conclusion, HTML entities help display HTML reserved characters and hard-to-key-in characters.

0
Subscribe to my newsletter

Read articles from DJEDEMIN Landry Modeste directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

DJEDEMIN Landry Modeste
DJEDEMIN Landry Modeste