Things you want to know about websites

 

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 Value

To type the character by using its base 10 or decimal value, type:

&#n;

Where n is its decimal value.

For example,

&#169;

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,

&#xa9;

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: &lt; and this is greater than sign: &gt;.</p>

prints;

This is less than sign: < and this is greater than sign: >.

Useful Character Entities

Character Description Entity Decimal value
< Less than &lt; &#60;
> Greater than &gt; &#62;
  Space &nbsp; &#160;
© Copyright &copy; &#169;
® Registered &reg; &#174;
Trademark &trade; &#8482;
& Ampersand &amp; &#38;
" Double quote &quot &#34;
Left double quotation &ldquo; &#8220;
Right double quotation &rdquo; &#8221;
£ Pound &pound; &#163;
Euro &euro; &#8364;

Bookmark or Add to Favourites

Next:

Html-CSS

Related:

Html-Colors
Html-Formatting

Link to this page :

Copy and paste the following code in an html document to link to this page,