HTML Entities

To replace the reserved characters in HTML, as well as to replace the characters that are not present on a keyboard, the HTML character entities are used. It thus provides a wide range of characters to add icons, geometric shapes, mathematical operators, etc. To use an entity in an HTML document one can either use it by name or by a numerical character reference. The ampersand (&) and the semicolon (;) symbols are used to start and end an entity respectively.




Advantages of using Entity Name:

It is easy to remember an entity name.

Disadvantages of using Entity Name:

All entity names may not be supported by every browser. However, the support for the entity numbers is good.

Popular HTML Character Entities:

Result Description Entity Name Entity Number
non-breaking space    
< less than &lt; &#60;
> greater than &gt; &#62;
& ampersand &amp; &#38;
double quotation mark &quot; &#34;
single quotation mark (apostrophe) &apos; &#39;
¢ cent &cent; &#162;
£ pound &pound; &#163;
¥ yen &yen; &#165;
Euro &euro; &#8364;
© copyright &copy; &#169;
® registered trademark &reg; &#174


<!DOCTYPE html>  
<p>&#34;HELLO WORLD!!&#34;</p>  
<p>&#60;HELLO WORLD!!&#62;</p>  


In the above example, we used the Entity Number to replace the reserved character in HTML.

HTML Diacritical Marks:

The “glyph” added to the HTML letters to the top or below the letters, inside a letter, or between two letters, is called the HTML diacritical mark. The HTML Diacritical marks, like grave ( ̀) and acute ( ́) are often known as accents. Some of the HTML diacritical marks are:

Mark Character Construct Result
̀ a a&#768;
́ a a&#769;
̂ a a&#770;
̃ a a&#771;
̀ O O&#768;
́ O O&#769;
̂ O O&#770;
̃ O O&#771;