Learn Basic HTML Complete Course part 25

1 min read

 HTML Entities

HTML character entities are used as a replacement of reserved characters in HTML. You can also replace characters that are not present on your keyboard by entities.

These characters are replaced because some characters are reserved in HTML. HTML entities provide a wide range of characters which can allow you to add icons, geometric shapes, mathematical operators, etc.

For example: if you use less than (<) or greater than (>) symbols in your text, the browser can mix them with tags that's why character entities are used in HTML to display reserved characters.


How to use an entity:


You can use an entity in your HTML document by name or by a numerical character reference. Each entity starts with symbol ampersand (&) and ends with a semicolon (;).

Syntax:

&amp;entity_name; OR &amp;#entity_number;&nbsp;


Most used HTML Character Entities


ResultDescriptionEntity NameEntity Number
 non-breaking space&nbsp;160
<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


📍Entity names are case sensitive.

🔺Advantage of entity name : An entity name is easy to remember.

🔺Disadvantage of entity name : Browsers may not support all entity names, but the support for numbers is good.


You may like these posts

  • In this article, I am going to share some of the best, free online courses to learn Web Development using HTML and CSS. If you are new to web development space then you can use the…
  • HTML HeadThe HTML <head> element is used as a container for metadata (data about data). It is used between <html> tag and <body> tag.The head of an HTML document …
  • Building blocks of HTMLAn HTML document consist of its basic building blocks which are:Tags: An HTML tag surrounds the content and apply meaning to it. It is written between &…
  • HTML TagsHTML tags are like keywords which defines that how web browser will format and display the content. With the help of tags, a web browser can distinguish between an HTML co…
  • HTML AnchorThe HTML anchor tag defines a hyperlink that links one page to another page. It can create hyperlink to other web page as well as files, location, or any URL. …
  • HTML iframesHTML Iframe is used to display a nested webpage (a webpage within a webpage). The HTML <iframe> tag defines an inline frame.Iframe SyntaxAn HTML iframe is defined…

Post a Comment