Skip to main content

HTML Characters, Symbols and Emojies

By SamK
0
0 recommends
Topic(s)

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 &lt; for <

Use &gt; 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 &#60; for < and &#60; 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: &nbsp;.

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 &nbsp; character entity. For example:

<p>This line has 5&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;spaces.</p>

Multiple Spaces Demo

More HTML Character Entities

& : &amp; or &#38;

" : &quot; or &#34;

' : &apos; or &#39;

© : &copy; or &#169; 

® : &reg; or &#174;

¢ : &cent; or &#162;

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:

£ : &pound; or &#163;

¥ : &yen; or &#165;

: &euro; or &#8364;

: &infin; or &#x221E;

: &prod; or &#x220F;

: &sum; or &#x2211;

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:

😀   &#128512;

😁   &#128513;

😂   &#128514;

😃   &#128515;

😄   &#128516;

😅   &#128517;

Please check below options for the links to our previous or next tutorial.

Questions & Answers