HTML - Entities

HTML Entities

In HTML there is a special meaning for some characters like the < character and cannot be used in the text. We have to use a character entity to display a less than sign in HTML.

Character Entities

In HTML some characters have a special meaning by defining the start of an HTML tag by less than sign (<). We have to insert character entities in the HTML source if want to display actual characters in the browser.

There are three parts of a character: an ampersand (&), an entity name or a # and an entity number, and a semicolon finally.

We must write < or < to display a less than sign in HTML document. The name is used instead of a number because a name is easier to remember. The newest entity names are not supported by all the browsers. In almost all browsers the support for entity numbers is very good and the entities are case sensitive.

Entity Syntax


Entity Examples

For Example
Result Description Entity Name Entity Number
  non-breaking space &nbsp; 160
> greater than &gt; 62
& ampersand &amp; 38
< less than &lt; 60
© copyright &copy; 169
" double quotation mark &quot; 34
¢ cent &cent; 162
£ pound &pound; 163
' single quotation mark (apostrophe) &apos; 39
¥ yen &yen; 165
Euro &euro; 8364
® registered trademark &reg; 174

Combining Diacritical Marks

There are some special types of letters used in HTML whichhave some glyph added to the top or below the letters. These glyphs are called diacritical mark.

Some diacritical marks, like grave ( ̀) and acute ( ́) are called accents.

Here are some examples −

For Example
Mark Character Construct Result
 ̀ a a&#768;
 ́ a a&#769;
̂ a a&#770;
 ̃ a a&#771;
̂ O O&#770;
 ̀ O O&#768;
 ́ O O&#769;
 ̃ O O&#771;