HTML Character Entity


Reserved characters in HTML must be replaced with character entities.

Some characters that are not found on the keyboard can also be replaced with character entities.


HTML Entity

In HTML, some characters are reserved.

In HTML, the less-than sign (<) and greater-than sign (>) cannot be used, as the browser will interpret them as tags.

In order to display reserved characters correctly, we must use character entities (character entities) in the HTML source code. Character entities look like this:

&entity_name;

or

&#entity_number;

To display the less-than sign, we must write it like this:&lt;or &#60;or&#060;

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


Non-breaking Space

Common character entities in HTML include the non-breaking space (&nbsp;).

Browsers always truncate spaces in HTML pages. Before displaying a page, they will delete 9 out of 10 spaces you write in the text. To increase the number of spaces on the page, you need to use the &nbsp; character entity.


Combining Diacritical Marks

An "glyph (character)" is added to a letter to produce an "intonation mark (diacritical mark)".

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

Diacritical marks can appear above and below a letter, inside a letter, or between two letters.

Diacritical marks can be used with combinations of letters and numeric characters.

Here are some examples:

Diacritical Marks Character Construct Output
  ̀ a a&#768; à
  ́ a a&#769; á
̂ a a&#770; â
  ̃ a a&#771; ã
  ̀ O O&#768; Ò
  ́ O O&#769; Ó
̂ O O&#770; Ô
  ̃ O O&#771; Õ


HTML Character Entity

Note

Entity names are case-sensitive!


Display Output Description Entity Name Entity Number
  Space &nbsp; &#160;
< Less-than sign &lt; &#60;
> Greater-than sign &gt; &#62;
& Ampersand &amp; &#38;
" Quotation marks &quot; &#34;
' Acute accent &apos; (IE does not support) &#39;
¢ Divide &cent; &#162;
£ Pound &pound; &#163;
¥ Yuan/CNY, Yen/JPY &yen; &#165;
€ Euro &euro; &#8364;
§ Section &sect; &#167;
© Copyright &copy; &#169;
® Registered trademark &reg; &#174;
™ Trademark &trade; &#8482;
× Multiplication sign &times; &#215;
÷ Division sign &divide; &#247;

Although HTML is case-insensitive, character entities are case-sensitive.

To view the complete HTML entity reference on this site, please click here.HTML Entity Reference Manual。

Other Extensions