HTML Entities

Some characters in HTML has special meaning. We have already been using < to mark the start of a tag. . What hapens if we want to display these characters itself ? We do so using character entities.

A character entity starts with an ampersand (&). It is followed by the entity name or a # and an entity number. Finally a semicolon (;).

We know that if we have many spaces between words, html ignores them and puts out just one space. If we want to actually put out spaces we use the html entity &nbsp;

The HTML entity for < sign is &lt; . The lt stands for less than. That makes it easier to understand. The HTML entity for > sign is &gt; . The gt stads for greater than.

You may like to study the table below and practice more HTML entities

Example - Understanding HTML Entities

The Most Common Character Entities:

Result Description Entity Name Entity Number
  non-breaking space &nbsp; &#160;
< less than &lt; &#60;
> greater than &gt; &#62;
& ampersand &amp; &#38;
" quotation mark &quot; &#34;
' apostrophe  &apos; &#39;