CodesJava

Easy learning with example program codes

HTML Entities

To replace the reserved characters in HTML, as well as to replace the characters that are not present on a keyboard, the HTML character entities are used. It thus provides a wide range of characters to add icons, geometric shapes, mathematical operators, etc. To use an entity in an HTML document one can either use it by name or by a numerical character reference. The ampersand (&) and the semicolon (;) symbols are used to start and end an entity respectively.

Syntax:

&entity_name;

OR 

&#entity_number;

Advantages of using Entity Name:

It is easy to remember an entity name.

Disadvantages of using Entity Name:

All entity names may not be supported by every browser. However, the support for the entity numbers is good.

Popular HTML Character Entities:

ResultDescriptionEntity NameEntity Number
non-breaking space  
<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

Example:

<!DOCTYPE html>  
<html>    
<body>  
<p>&#34;HELLO WORLD!!&#34;</p>  
<p>&#60;HELLO WORLD!!&#62;</p>  
</body>  
</html>

Output:

Explanation:

In the above example, we used the Entity Number to replace the reserved character in HTML.

HTML Diacritical Marks:

The “glyph” added to the HTML letters to the top or below the letters, inside a letter, or between two letters, is called the HTML diacritical mark. The HTML Diacritical marks, like grave ( ̀) and acute ( ́) are often known as accents. Some of the HTML diacritical marks are:

MarkCharacterConstructResult
̀aa&#768;
́aa&#769;
̂aa&#770;
̃aa&#771;
̀OO&#768;
́OO&#769;
̂OO&#770;
̃OO&#771;
Please follow and like us:
error
Posted in HTML   









Copyright © 2019 CodesJava DMCA.com Protection Status