HTML Entities
HTML character entities are used as a replacement of reserved characters in HTML. You can also replace characters that are not present on your keyboard by entities.
These characters are replaced because some characters are reserved in HTML. HTML entities provide a wide range of characters which can allow you to add icons, geometric shapes, mathematical operators, etc.
For example: if you use less than (<) or greater than (>) symbols in your text, the browser can mix them with tags that's why character entities are used in HTML to display reserved characters.
How to use an entity:
You can use an entity in your HTML document by name or by a numerical character reference. Each entity starts with symbol ampersand (&) and ends with a semicolon (;).
Syntax:
Most used HTML Character Entities
Result | Description | Entity Name | Entity Number |
---|---|---|---|
non-breaking space | | 160 | |
< | less than | < | 60 |
> | greater than | > | 62 |
& | ampersand | & | 38 |
" | double quotation mark | " | 34 |
' | single quotation mark (apostrophe) | ' | 39 |
¢ | cent | ¢ | 162 |
£ | pound | £ | 163 |
¥ | yen | ¥ | 165 |
€ | Euro | € | 8364 |
© | copyright | © | 169 |
® | registered trademark | ® | 174 |
Note:Entity names are case sensitive.
Advantage of entity name: An entity name is easy to remember.
Disadvantage of entity name: Browsers may not support all entity names, but the support for numbers is good.
Example:
Diacritical Marks in HTML
There are some special types of letters used in HTML whichhave some glyph added to the top or below the letters. These glyphs are called diacritical mark.
Some diacritical marks, like grave ( ̀) and acute ( ́) are called accents.Diacritical marks can be used both above and below a letter, inside a letter, and between two letters.
Following is a list of some diacritical marks:
Mark | Character | Construct | Result |
---|---|---|---|
̀ | a | à | à |
́ | a | á | á |
̂ | a | â | â |
̃ | a | ã | ã |
̀ | O | Ò | Ò |
́ | O | Ó | Ó |
̂ | O | Ô | Ô |
̃ | O | Õ | Õ |
0 Comments