Introduction to HTML Entities

HTML-Entities

Introduction to HTML Entities

This article lets us learn how to define HTML entities to display special characters on the browser, and they are case sensitive. HTML Entities are also termed as Character entity references which help to include various characters to an HTML document like all the symbols are declared as entities followed by ampersand symbol (&). Well-Used characters or reserved characters in HTML tag is lesser / greater than symbol (<,>); when a browser identifies this character, it interprets automatically (understood that they are mark-up language). Html entitiesโ€™ main benefits are easy to use, and remember, it replaces the characters that are not on the keyboard. Here we will discuss different types of entities and basic examples to illustrate the functionality.

Syntax for HTML Entities

HTML entities give different varieties of characters, assigning icons, mathematical operators, and even geometric complex shapes.

Representation: HTML entities are declared using an ampersand (&) with (#) pound character and finally ended with a semicolon; These three elements are very important to avoid complications.

Syntax:

1. Using a Character Entity

& [Entity name character];

2. Using Number

&#Entity no;

Explanation: The name is easy to remember than the number. Not all the browsers are compatible with the reserved names, but the entity numbers are good on browsers. The browsers which do not supports this symbol are displayed as boxes. Html Entities are widely used in the area like a different foreign language (European Language), Punctuation elements, Greek characters, and mathematical Symbols lastly for shapes and arrows. Entity code is much important to avoid a strange error that is difficult to pinpoint. HTML entities organize, followed by the lists like letters/Symbols with Accents using Unicode, Phonetics Foreign Characters, Currency, Other symbols like smart quotes (These are with straight long dashes).

Different HTML Entities in Tabular Format

Let us see different Characters Entities.

1. HTML Character Entities

Below are the entity codes for most used entities like common currency.

CharacterEntity NameEntity NumberExplanation/ Description
ยข&cent;&#162 ; It denotes Cent Sign of currency
&&amp;&#38 ;It denotes frequently used Ampersand Symbol
ยฎ&reg;&#174 ;Gives Registered Symbol
โ„ข&trade&#8482 ;Trade Mark
ยฉ&copy;&#169 ;Gives Copy-right Symbol
ยค&current;&#164 ; It defines a Generic currency Symbol
>&gt;&#62 ;It denotes greater than sign
<&lt;&#60 ;It denotes lesser than sign
&nbsp;&#160 ;It defines for Non-Breaking Spaces
โ‚ฌ&euro;&#8364 ;It defines the British Euro Symbol
โ€œ&quot;&#34 ;Gives double quotes in a given text
โ€˜&apos;&#39 ;Includes Apostrophe in a sentence
ยฃ&pound;&#163 ;Specifies British Pound Currency
ยฅ&yen;&#165 ;Specifies Japanese Currency Symbol
$&dollar;&#36 ;Specifies Dollar currency

2. Mathematical Operators as Character Entities

Generates Math Symbols into the HTML Code.

%&percnt;&#37 ;Gives Percentage symbol to calculate
(&#40 ;Used as Open Parenthesis
)&#41 ;Used as Closed Parenthesis
*&#42 ;Asterisk
รท&divide; or &div;&#247 ;Includes dividion Sigh
+&#43 ; Specifies Plus sign
,&#44 ;Specifies Comma
ยฑ&plusmn;&#177 ;Indicates plus- or- minus symbol
โ€“&#45 ; Used as Hyphen sign
.&#46 ;Period
ยฆ&brvbar;&#166 ;Broken Vertical bar
\&bsol;&#92 ;Defines Absolute value
ยผ&frac14;&#188 ; Fraction part ยผ
ยฝ&frac12;&#189 ;Fraction Part 1/2
]&rbrack;&#93 ;Denotes brackets
โˆ‘&Sum;&#8721 ;Defies in summation calculation
โˆš&radic ; &Sqrt;&#8730 ;Gives Square Root result
โˆž&infin;&#8734 ;Gives Infinity Value
โˆ&prod;&#8719 ;n- array product
โŠ‚&sub;&#8834 ;Denotes Subset of
โŠƒ&sup;&#8835 ;Denotes Super Set In the Set theory

3. Arrow Symbols

Following are the different arrow symbols.

โ†&larr;&#8592 ;Leftwards Arrow
โ†‘&uarr;&#8593 ;Upwards Arrow
โ†’&rarr;&#8594 ;Rightwards Arrow
โ†“&darr;&#8595 ;Downwards Arrow
โ†”&harr;&#8596 ;Left-right Arrow

4. Latin Entities or Accents Letters

The Accent type issues this list with the Unicode sections. And the number specifies the numeric position. Some may not be supported in older browsers like Netscape. Popular Course in this categoryHTML Training (12 Courses, 19+ Projects, 4 Quizzes)12 Online Courses | 19 Hands-on Projects | 89+ Hours | Verifiable Certificate of Completion | Lifetime Access | | 4 Quizzes with Solutions
4.5 (6,492 ratings)Course Price
โ‚น6999 โ‚น41999
View Course


Related CoursesBootstrap Training (2 Courses, 6+ Projects)XML Training (5 Courses, 6+ Projects)CSS Training (9 Courses, 9+ Projects)

 ยก&iexcl;ยก ;inverted exclamation mark
 ยข&cent;ยข ;cent sign
 ยง&sect;ยง ;Section sign
ร€&Agrave;ร€ ;Caps a, done with a grave accent
ร&aacute;รก ;Caps a, done with an acute accent
รˆ&Egrave;รˆ ;Capital E
ร&ETHร ;Specifics, Icelandic
ยต&micro;ยต ;Micro Sign
รฑ&ntildleรฑ ;Specifies small letter โ€˜nโ€™ with a tilde

5. Modifier Characters

The modifier characters of HTML entities are given below.

   ห†&circ;Modifier Letter
  ~&tilde; Specifies a small tilde

6. Other Entities in HTML

The other entities in HTML are given below.

&enspโ€‚ ; En space
&emspโ€ƒ ;em space
โ€ &dagger;โ€  ;Denotes dagger
โ€ก&double dagger;โ€ก ; Denotes Double dagger
ลก&Scaron;ล  ;Specifies smalls with a caron above

In the following sections, we shall have a look at Entities on Html Document and the output we see in the browsers.

Examples of HTML Entities

Following are the different examples of HTML entities.

Example #1 โ€“ Non-Breaking Space

Additional space between the words is given by using Non- Breaking entities. Following is an implementation of the Non-Breaking space between the sentence. A single wide space is included.

Code:

<!DOCTYPE html>
<html>
<head>
<title> Non-Breaking Space Example</title>
</head>
<body>
<h3>Non-Breaking Space Example</h3>
<p> <p> <b>Life is So Beautiful, must enjoy
To the peak!</b></p></p>
</body>
</html>

Output:

HTML Entities 1-1

Example #2 โ€“ Includes Quotes in a LineOutput

Code:

<!DOCTYPE html>
<html>
<head>
<title>HTML Entities Demo</title>
</head>
<body>
<div id = "John &quot &amp Harry ">
</body>
</html>

Output:

HTML Entities 1-2

Example #3 โ€“ Using the Trademark symbol with CSS Style

Code:

<!DOCTYPE html>
<html>
<head>
<title>Web Title</title>
<style>
body {
background-color: yellow;
text-align: center;
color: green;
font-family: verdana, Helvetica;
}
</style>
</head>
<body>
<h3> Registered Trademark Symbol: </h3> <h3>HTML Entities demo: </h3> <p>ยฎ</p> <p>ยฎ</p> <p> This Registered Trademark is a Script used in HTML document. </p>
</body>
</html>

Output:

Output 4

Example #4 โ€“ Using Lesser and Greater than Symbol

Code:

<!DOCTYPE html>
<html>
<body>
<h2>I want to display &lt;br&gt; tag</h2>
<p>I want to display &lt;i&gt; tag</p>
</body>
</html>

Output:

Output 4

Conclusion

To the end, we understood the meaning of special characters implemented in the Html document. In some situations, web pages are in need of these special symbols. All these Entities can be used on a website to display the characters. Our system keyboard supports some technical and currency symbols using these symbols to display on the HTML page.

Recommended Articles

This is a guide to HTML Entities. Here we discuss the Introduction and different HTML entities in tabular format along with examples and code implementation. You may also look at the following articles to learn more โ€“

  1. Quotation Tag in HTML
  2. Iframes Tags in HTML
  3. HTML Align Center
  4. HTML Display Block

Leave a Comment

Your email address will not be published. Required fields are marked *