HTML Entities
There are certain characters in Html which are reserved for the markup language (e.g < or >). If you try to print these characters, your browser will confuse them to be a part of the code and will not print them correctly.
In order to print these characters correctly, we can reference these characters by their unicode value, which can be decimal (base 10) or hexadecimal (base 16) or we can use character entities which is a basically a word associated with that character.
We will see here both, how to reference by unicode and by entities.
Reference by Unicode
Decimal ValueTo type the character by using its base 10 or decimal value, type:
&#n;
Where n is its decimal value.
For example,
©
gives,
©
Hexadecimal value
To type the character by using its base 16 or hexa decimal value, type:
&#xn;
Where n is its hexa decimal value.
For example,
©
gives,
©
Character Entities
You can also use entities for printing many characters. They are easier to remember and type if you use them frequently. Type an entity like this,
Type & then entity name and then ; .
For example,
<p>This is less than sign: < and this is greater than sign: >.</p>
prints;
This is less than sign: < and this is greater than sign: >.
Useful Character Entities
Character | Description | Entity | Decimal value |
< | Less than | < | < |
> | Greater than | > | > |
Space | |   | |
© | Copyright | © | © |
® | Registered | ® | ® |
™ | Trademark | ™ | ™ |
& | Ampersand | & | & |
" | Double quote | " | " |
“ | Left double quotation | “ | “ |
” | Right double quotation | ” | ” |
£ | Pound | £ | £ |
€ | Euro | € | € |
Next:
Related:
Link to this page :
Copy and paste the following code in an html document to link to this page,