HTML character entities are used as a replacement for reserved characters in HTML.
For example, < and > are used to define HTML tags. If you want to display < or > in HTML, you need to replace these with HTML entities, so that the browser should not interpret them as HTML tags.
Use < for <
Use > for >
You can either use entity names or entity numbers.
Entity names have the following structure.
&entity_name; Entity numbers have the following structure.
&#entity_number;In case of entity numbers, you can use < for < and < for >.
Entity names are easier to remember than entity numbers, because they often correspond to the character they represent.
Multiple Spaces
A commonly used HTML entity is the non-breaking space: .
It is mostly used to prevent browsers from truncating spaces in HTML pages.
For example, if you include 5 spaces in your text, the browser will remove 4 of them. To add real spaces to your text, you can use the character entity. For example:
<p>This line has 5 spaces.</p>
More HTML Character Entities
& : & or &
" : " or "
' : ' or '
© : © or ©
® : ® or ®
¢ : ¢ or ¢
HTML Symbol Entities
To add symbols like £ or € to an HTML page, you can utilize either the symbol entity name or the symbol entity number, which can be a decimal or a hexadecimal reference for the symbol.
Some commonly used HTML symbols are:
£ : £ or £
¥ : ¥ or ¥
€ : € or €
∞ : ∞ or ∞
∏ : ∏ or ∏
∑ : ∑ or ∑
HTML Emojis:
Emojis resemble images or icons, but they are actually characters from the UTF-8 (Unicode) character set.
UTF-8 encompasses a vast range of characters and symbols from around the world.
Some commonly used emojis are:
😀 😀
😁 😁
😂 😂
😃 😃
😄 😄
😅 😅
Please check below options for the links to our previous or next tutorial.