HTML Entities

HTML Tutorial

HTML Entities

Completed

Reserved characters in HTML should be replaced by character entities.

inclusion of Characters which are not present on your keyboard can also be done using entities.

HTML Entities

Completed

In HTML, Some characters are kept reserved .

when you are using the less than (<) or greater than (>) signs in your text, the browser can possibily mix them with tags.

Character entities are utilised for displaying reserved characters in HTML.

A character entity will appear like this:

&entity_name;

OR

&#entity_number;

for displaying a less than sign (<) we must write: < or <

Non-breaking Space

Completed

A common character entity which is predominantly used in HTML is the non-breaking space: &nbsp;

A non-breaking space can be said as a space which will not be breaking into a new line.

Two words that are separated using a non-breaking space will stick together (i.e not break into a new line). This is useful and handy while breaking the words might become disruptive.

Examples:

  • § 10
  • 10 km/h
  • 10 PM

Another common usage of the non-breaking space is prevention of browsers for truncating spaces in HTML pages.

If you are using 10 spaces in your text, 9 of them will be removed by the browser.For adding real spaces to your text, usage of &nbsp; character entityis helpful.

Some Other Useful HTML Character Entities

Completed
Result Description Entity Name Entity Number
non-breaking space &nbsp; &#160;
< less than &lt; &#60;
> greater than &gt; &#62;
& ampersand &amp; &#38;
¢ cent &cent; &#162;
£ pound &pound; &#163;
¥ yen &yen; &#165;
€ euro &euro; &#8364;
© copyright &copy; &#169;
® registered trademark &reg; &#174;

Combination of Diacritical Marks

Completed

A diacritical mark can be called as a "glyph" which is added to a letter.

Some of the diacritical marks, such as grave ( ̀) and acute ( ́) are called accents.

Diacritical marks can be appearing at both above and below a letter or inside a letter or in-between two letters.

combinations of diacritical marks can also be utilised in combination, to produce a character that is not present in the character set (encoding) used in the page.

you can see some examples here:

Mark Character Construct Result
 ̀ a a&#768; à
 ́ a a&#769; á
̂ a a&#770; â
 ̃ a a&#771; ã
 ̀ O O&#768; Ò
 ́ O O&#769; Ó
̂ O O&#770; Ô
 ̃ O O&#771; Õ

We can see more of HTML symbols in the following chapter of this tutorial.