html 字符实体
html 中的预留字符必须被替换为字符实体。
html 实体
在 html 中,某些字符是预留的。
在 html 中不能使用小于号(<)和大于号(>),这是因为浏览器会误认为它们是标签。
如果希望正确地显示预留字符,我们必须在 html 源代码中使用字符实体(character entities)。
字符实体类似这样:
&entity_name;
或者
&#entity_number;
如需显示小于号,我们必须这样写:< 或 <
不间断空格(non-breaking space)
html 中的常用字符实体是不间断空格( )。
浏览器总是会截短 html 页面中的空格。如果您在文本中写 10 个空格,在显示该页面之前,浏览器会删除它们中的 9 个。如需在页面中增加空格的数量,您需要使用 字符实体。
html 实例示例
用 html 实体符号做实验: here
html 中有用的字符实体
注释:实体名称对大小写敏感!
显示结果 | 描述 | 实体名称 | 实体编号 |
---|---|---|---|
空格 | |   | |
< | 小于号 | < | < |
> | 大于号 | > | > |
& | 和号 | & | & |
" | 引号 | " | " |
' | 撇号 | ' (ie不支持) | ' |
¢ | 分(cent) | ¢ | ¢ |
£ | 镑(pound) | £ | £ |
¥ | 元(yen) | ¥ | ¥ |
€ | 欧元(euro) | € | € |
§ | 小节 | § | § |
? | 版权(copyright) | © | © |
? | 注册商标 | ® | ® |
? | 商标 | ™ | ™ |
× | 乘号 | × | × |
÷ | 除号 | ÷ | ÷ |
如需完整的实体符号参考,请访问我们的 html 实体符号参考手册。
html iso-8859-1 参考手册
html 4.01 支持 iso 8859-1 (latin-1) 字符集。
iso-8859-1 的较低部分(从 1 到 127 之间的代码)是最初的 7 比特 ascii。
iso-8859-1 的较高部分(从 160 到 255 之间的代码)全都有实体名称。
这些符号中的大多数都可以在不进行实体引用的情况下使用,但是实体名称或实体编号为那些不容易通过键盘键入的符号提供了表达的方法。
注释:实体名称对大小写敏感。
带有实体名称的 ascii 实体
结果 | 描述 | 实体名称 | 实体编号 |
---|---|---|---|
" | quotation mark | " | " |
' | apostrophe? | ' | ' |
& | ampersand | & | & |
< | less-than | < | < |
> | greater-than | > | > |
iso 8859-1 符号实体
结果 | 描述 | 实体名称 | 实体编号 |
---|---|---|---|
? | non-breaking space | |   |
? | inverted exclamation mark | ¡ | ¡ |
¢ | cent | ¢ | ¢ |
£ | pound | £ | £ |
¤ | currency | ¤ | ¤ |
¥ | yen | ¥ | ¥ |
| | broken vertical bar | ¦ | ¦ |
§ | section | § | § |
¨ | spacing diaeresis | ¨ | ¨ |
? | copyright | © | © |
a | feminine ordinal indicator | ª | ª |
? | angle quotation mark (left) | « | « |
? | negation | ¬ | ¬ |
- | soft hyphen | ­ | ­ |
? | registered trademark | ® | ® |
ˉ | spacing macron | ¯ | ¯ |
° | degree | ° | ° |
± | plus-or-minus? | ± | ± |
2 | superscript 2 | ² | ² |
3 | superscript 3 | ³ | ³ |
′ | spacing acute | ´ | ´ |
μ | micro | µ | µ |
? | paragraph | ¶ | ¶ |
· | middle dot | · | · |
? | spacing cedilla | ¸ | ¸ |
1 | superscript 1 | ¹ | ¹ |
o | masculine ordinal indicator | º | º |
? | angle quotation mark (right) | » | » |
? | fraction 1/4 | ¼ | ¼ |
? | fraction 1/2 | ½ | ½ |
? | fraction 3/4 | ¾ | ¾ |
? | inverted question mark | ¿ | ¿ |
× | multiplication | × | × |
÷ | division | ÷ | ÷ |
iso 8859-1 字符实体
结果 | 描述 | 实体名称 | 实体编号 |
---|---|---|---|
à | capital a, grave accent | à | À |
á | capital a, acute accent | á | Á |
a | capital a, circumflex accent | â | Â |
? | capital a, tilde | ã | Ã |
? | capital a, umlaut mark | ä | Ä |
? | capital a, ring | å | Å |
? | capital ae | æ | Æ |
? | capital c, cedilla | ç | Ç |
è | capital e, grave accent | è | È |
é | capital e, acute accent | é | É |
ê | capital e, circumflex accent | ê | Ê |
? | capital e, umlaut mark | ë | Ë |
ì | capital i, grave accent | ì | Ì |
í | capital i, acute accent | í | Í |
? | capital i, circumflex accent | î | Î |
? | capital i, umlaut mark | ï | Ï |
e | capital eth, icelandic | ð | Ð |
? | capital n, tilde | ñ | Ñ |
ò | capital o, grave accent | ò | Ò |
ó | capital o, acute accent | ó | Ó |
? | capital o, circumflex accent | ô | Ô |
? | capital o, tilde | õ | Õ |
? | capital o, umlaut mark | ö | Ö |
? | capital o, slash | ø | Ø |
ù | capital u, grave accent | ù | Ù |
ú | capital u, acute accent | ú | Ú |
? | capital u, circumflex accent | û | Û |
ü | capital u, umlaut mark | ü | Ü |
y | capital y, acute accent | ý | Ý |
t | capital thorn, icelandic | þ | Þ |
? | small sharp s, german | ß | ß |
à | small a, grave accent | à | à |
á | small a, acute accent | á | á |
a | small a, circumflex accent | â | â |
? | small a, tilde | ã | ã |
? | small a, umlaut mark | ä | ä |
? | small a, ring | å | å |
? | small ae | æ | æ |
? | small c, cedilla | ç | ç |
è | small e, grave accent | è | è |
é | small e, acute accent | é | é |
ê | small e, circumflex accent | ê | ê |
? | small e, umlaut mark | ë | ë |
ì | small i, grave accent | ì | ì |
í | small i, acute accent | í | í |
? | small i, circumflex accent | î | î |
? | small i, umlaut mark | ï | ï |
e | small eth, icelandic | ð | ð |
? | small n, tilde | ñ | ñ |
ò | small o, grave accent | ò | ò |
ó | small o, acute accent | ó | ó |
? | small o, circumflex accent | ô | ô |
? | small o, tilde | õ | õ |
? | small o, umlaut mark | ö | ö |
? | small o, slash | ø | ø |
ù | small u, grave accent | ù | ù |
ú | small u, acute accent | ú | ú |
? | small u, circumflex accent | û | û |
ü | small u, umlaut mark | ü | ü |
y | small y, acute accent | ý | ý |
t | small thorn, icelandic | þ | þ |
? | small y, umlaut mark | ÿ | ÿ |