Warning: DOMDocument::createElement(): invalid decimal character value in /home/mrexamples/public_html/wp-content/themes/awaken/functions.php on line 1281

HTML Entities

The topic of today’s discussion is HTML Entities. Character entities must replace reserved characters in HTML.

In HTML Entities, some characters are reserved. You may get tags mixed up with your text if you use the less than (<) or greater than (>) signs.

A character entity shows reserved characters in HTML entities.

Here is an example of a character entity:

&entity_name;OR

&#entity_number;

When portraying a less-than-sign (<) we must write: &lt; or <

A benefit of entities: HTML Entities are easy to remember.

A disadvantage of entity names: Some web browsers don’t support all entity names but do support entity numbers.


Non-breaking Space

Non-breaking spaces are generally utilized in HTML Entities: &nbsp;

Spaces that don’t split into new lines are called non-breaking spaces.

Spaces between words will not break them (not form new lines). You can operate this when breaking words could be disruptive.

Examples:

  • § 10
  • 10 km/h
  • 10 PM

HTML pages are also commonly truncated by web browsers due to non-breaking spaces.

Nine spaces will trim your text if you write 10 of them. The &nbsp; character entity in HTML Entities can add natural spaces to your text.

Non-breaking hyphens (‑) represent hyphens (‑) that do not break into new lines.<!–

Advertisement

–><!–

mid_content, all: [300,250][336,280][728,90][970,250][970,90][320,50][468,60]

–>


Some Useful HTML Character Entities

ResultOverviewEntity NameEntity Number
non-breaking space&nbsp;
<less than&lt;<
>greater than&gt;>
double quotation mark&quot;"
single quotation mark (apostrophe)&apos;'
£pound&pound;£
&ampersand&amp;&
®registered trademark&reg;®
¢cent&cent;¢
Â¥yen&yen;¥
©copyright&copy;©
€euro&euro;

Take note that HTML Entities are case-sensitive while naming entities.


Combining Diacritical Marks

Diacritical marks are glyphs added to letters.

It is called an accent when diacritical marks like grave, as distinct from acute, are used.

Letters can be diacritical marked above, below, inside, and between them.

Characters not present in the character set (encoding) used on a page can be generated by pairing diacritical marks with alphanumeric characters.

A few examples are as follows:

MarkCharacterConstructResult
̃aã
Ìa
̂aâ
̀aà
Ì‚OOÌ‚
Ì€OOÌ€
̃OÕ
ÌO
Tip : The next chapter of this lesson will cover more HTML symbols.

Advantages of HTML Entities

HTML entities are special codes that can be used in web development to include special characters and symbols. Here are the advantages of using HTML entities:

  1. Compatibility: HTML entities ensure that special characters and symbols are displayed correctly across different web browsers and platforms.
  1. Accessibility: Using HTML entities can make web pages more accessible to people with disabilities, as assistive technologies can interpret them.
  1. Consistency: HTML entities provide a standard set of codes that ensure that web pages are created uniformly, which leads to better user experience and easy navigation.
  1. Security: HTML entities protect web pages from potential security threats such as cross-site scripting (XSS) attacks, enhancing the security of a web page.
Do subscribe to our Newsletter below, if you want to be in touch with the technical information on this site.
We value your feedback.
+1
0
+1
0
+1
0
+1
0
+1
0
+1
0
+1
0

Subscribe To Our Newsletter
Enter your email to receive a weekly round-up of our best posts. Learn more!
icon

Leave a Reply

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