๐ŸŽ‰ New: Top 75 PHP Interview Questions for 2026 โ€” Free for all learners

HTML Entities

P
php Guru
ยท February 27, 2023 ยท 2 min read ยท Updated February 27, 2023

๐Ÿ“Œ Key Takeaways

  • HTML Entities
  • How to use an entity:
  • Diacritical Marks in HTML
Advertisement

HTML character entities are used to replace characters that aren’t allowed to be used. You can also use entities to stand in for characters that you don’t have on your keyboard.

Some of these characters are changed because HTML doesn’t let you use all characters. HTML entities give you access to a wide range of characters that you can use to add icons, geometric shapes, mathematical operators, and other things.

For example, if you use the less than () or greater than (>) symbols in your text, the browser might mix them up with tags. This is why character entities are used in HTML to show reserved characters.

How to use an entity:

You can use an entity in an HTML document either by its name or by its number. Each thing begins with the symbol “&” and ends with a “;” (;).

Syntax:

ย &entity_name;
OR
&#entity_num;

 

Entities for HTML Characters Most Often Used

Result Description Entity Name Entity Number
non-breaking space   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.

A good thing about an entity name is that it’s easy to remember.

Entity names may not be supported by all browsers, but browsers do a good job of supporting numbers.

 

Diacritical Marks in HTML

In HTML, there are some special kinds of letters that have glyphs added to the top or bottom. The name for these symbols is diacritical mark.

Accents are some of the diacritical marks, like grave ( ฬ€) and acute ( ฬ€).

You can put diacritical marks above or below a letter, inside a letter, or between two letters.

Here are some examples of diacritical marks:

Mark Character Construct Result
ย ฬ€ a a&#768; aฬ€
ย ฬ a a&#769; aฬ
ฬ‚ a a&#770; aฬ‚
ย ฬƒ a a&#771; aฬƒ
ย ฬ€ O O&#768; Oฬ€
ย ฬ O O&#769; Oฬ
ฬ‚ O O&#770; Oฬ‚
ย ฬƒ O O&#771; Oฬƒ
P
php Guru
โ† Previous Post
HTML Computer Code Elements
Next Post โ†’
HTML Symbols

Leave a Reply

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

Prove your humanity: 0   +   3   =