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 *