HTML character entities

Spread the love

Reserved characters in HTML must be replaced with character entities.

Some characters not found on the keyboard can also be replaced using character entities.

HTML entities

In HTML, certain characters are reserved.

You cannot use the less than (<) and greater than (>) signs in HTML because browsers mistake them for tags.

If we want to display reserved characters correctly, we must use character entities in the HTML source code. Character entities look like this:

&entity_name;

或&#entity_number;

To display a less than sign, we must write: < or < or <

Tip: The advantage of using entity names instead of numbers is that they are easier to remember. However, the disadvantage is that browsers may not support all entity names (but support for entity numbers is good).

Non-breaking Space

A common character entity in HTML is the non-breaking space ( ).

Browsers always truncate spaces in HTML pages. If you write 10 spaces in text, the browser will remove 9 of them before displaying the page. To increase the number of spaces in a page, you need to use the   character entity.

Combined phonetic symbols

A diacritic is a “glyph” added to a letter.

Some diacritical marks, such as the acute accent (̀) and grave accent (́).

Diacritical marks can appear above or below letters, inside letters, or between letters.

Diacritical marks can be used in combination with alphabetic and numeric characters.

Here are some examples:

phonetic symbolscharacterConstructOutput results
  ̀aa&#768;à
  ́aa&#769;á
̂aa&#770;â
  ̃aa&#771;ã
  ̀OO&#768;Ò
  ́OO&#769;Ó
̂OO&#770;Ô
  ̃OO&#771;Õ

HTML character entities

Entity names are case sensitive!

Display resultsdescribeEntity NameEntity Number
 Space &nbsp; &#160;
<Less than sign&lt;&#60;
>Greater than sign&gt;&#62;
&and&amp;&#38;
quotation marks&quot;&#34;
Apostrophe &apos; (IE不支持)&#39;
point&cent;&#162;
£pound&pound;&#163;
¥RMB/JPY&yen;&#165;
EUR&euro;&#8364;
§Sections&sect;&#167;
©copyright&copy;&#169;
®registered trademark&reg;&#174;
trademark&trade;&#8482;
×multiplication sign&times;&#215;
÷division sign&divide;&#247;

Although HTML is not case sensitive, entity characters are case sensitive.

The resources on this site come from the Internet and are used for learning and research by Internet enthusiasts. If your rights are accidentally infringed, please contact the webmaster in time to handle and delete them. Please understand!
IT Resource Hub » HTML character entities

Leave a Reply

Provide the best collection of resources

View Now Learn More