HTML Entities

HTML Character Entities are set of characters which are used to display certain characters in wep pages. These characters are generally not available on keyboards or are reserved by HTML and work as something else than expected when placed within a group of texts.

For example, charcters like < or > are used to enclose HTML elements and thus cannot be written together and expect them to be displayed as they should in a text.

Moreover, characters like ™, © or £ are not available to directy input from keyboard.

A specific set of characters are used to display such characters in HTML which are called HTML Entities. These HTML entities are case-sensitive and written as &entityname; or &#entitynumber;.

All browsers may not support all entity names but they are easy to remember while entity numbers are highly supported by browsers but are hard to memorize.

Some Useful Character Entities

Result Description Entity Name Entity Number
  non-breaking space &nbsp; &#160;
< less than &lt; &#60 ;
> greater than &gt; &#62;
& ampersand &amp; &#38;
" double quotation mark &quot; &#34;
' single quotation mark (apostrophe) &apos; &#39;
¢ cent &cent; &#162;
£ pound &pound; &#163 ;
¥ yen &yen; &#165;
euro &euro; &#8364;
© copyright &copy; &#169;
® registered trademark &reg; &#174;
Trademark &trade; &#8482;
» Double Right Arrow &raquo;
« Double Left Arrow &laquo;

HTML Symbol Entities

A huge number of mathematical, technical as well as currency symbols are not found in the keyboard which are added to an HTML page using HTML entities.

Mathemmatical Symbols

Character Entity Name Entity Number
&forall; &#8704;
&part; &#8706;
&exist; &#8707;
&empty; &#8709;
&nabla; &#8711;
&isin; &#8712;
&notin; &#8713;
&ni; &#8715;
&prod; &#8719;
&sum; &#8721;

HTML Entities - Symbols

Character Entity Name Entity Number
&#8592; &larr;
&#8593; &uarr;
&#8594; &rarr;
&#8595; &darr;
&#9824;
&#9827; &clubs;
&#9829; &hearts;
&#9830; &diams;

HTML Character Encoding (Character Set)

HTML character set must be defined in an HTML page in order to display all the characters properly. Character encoding defines the alphanumeric characters that can be used in a web page like numbers 0-9, alphabets A-Z and symbols like !, &, #, $, @, etc.

ASCII character set supports 128 characters while character sets namely ANSI and ISO-8859-1 support 256 characters. UTF-8 (Unicode) supports almost all the characters and symbols in the entire world and thus is the default character encoding for HTML5.

The character set is specified using <meta> tag in HTML <head> section

<meta charset="UTF-8">

0 Like 0 Dislike 0 Comment Share

Leave a comment