HTML character entity, html character entity
Reserved characters in HTML must be replaced with character entities.
HTML Entity
Some characters are reserved in HTML.
You cannot use signs (<) or greater than signs (>) in HTML. This is because the browser mistakenly believes that they are tags.
To correctly display reserved characters, we must use character entities in the HTML source code ).
Character entities are similar to the following:
&entity_name;
&#entity_number;
To display a smaller sign, we must write as follows: & lt; or & #60;
Tip: the advantage of using entity names instead of numbers is that names are easy to remember. However, the disadvantage is that the browser may not support all Entity Names (the support for entity numbers is good ).
Useful character entities in HTML
Note: The object name is case sensitive!
Display result |
Description |
Entity name |
Entity ID |
|
Space |
& Nbsp; |
& #160; |
< |
Yu no. |
& Lt; |
& #60; |
> |
Yu no. |
& Gt; |
& #62; |
& |
And number |
& Amp; |
& #38; |
" |
Quotation marks |
& Quot; |
& Amp; #34; |
' |
Marker |
& Apos; (not supported by IE) |
& Amp; #39; |
Bytes |
Cent) |
& Cent; |
& #162; |
£. |
Pound (pound) |
& Pound; |
& #163; |
¥ |
Yuan (yen) |
& Yen; |
& #165; |
€ |
Euro (euro) |
& Euro; |
& #8364; |
§ |
Section |
& Sect; |
& #167; |
|
Copyright) |
& Copy; |
& #169; |
|
Registered Trademark |
& Reg; |
& #174; |
|
Trademark |
& Trade; |
& #8482; |
× |
Multiplication number |
& Times; |
& #215; |
Bytes |
Division Number |
& Divide; |
& #247; |
Reprinted: http://www.w3school.com.cn/html/html_entities.asp