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.
Syntax:
&entity_name; OR &#entity_number;
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 | < | < |
> | greater than | > | > |
& | ampersand | & | & |
“ | double quotation mark | " | " |
‘ | single quotation mark (apostrophe) | ' | ' |
¢ | cent | ¢ | ¢ |
£ | pound | £ | £ |
¥ | yen | ¥ | ¥ |
€ | Euro | € | € |
© | copyright | © | © |
® | registered trademark | ® | ® |
Example:
<!DOCTYPE html> <html> <body> <p>"HELLO WORLD!!"</p> <p><HELLO WORLD!!></p> </body> </html>
Explanation:
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 | á | á |
̂ | a | â | â |
̃ | a | ã | ã |
̀ | O | Ò | Ò |
́ | O | Ó | Ó |
̂ | O | Ô | Ô |
̃ | O | Õ | Õ |