当前位置: 首页 > 文档资料 > HTML 入门教程 >

实体(Entities)

优质
小牛编辑
121浏览
2023-12-01

某些字符在HTML中保留,在HTML文档中使用时具有特殊含义。 例如,您不能在HTML文本中使用大于或小于标记或尖括号,因为浏览器会以不同方式对待它们,并尝试绘制与HTML标记相关的含义。

HTML处理器必须支持下表中列出的以下五个特殊字符。

符号描述实体名称数字代码
"quotation mark""
'apostrophe ''
&ampersand&&
<less-than&lt;<
>greater-than&gt;>

例子 (Example)

如果你想将

写为代码,那么你必须写如下 -
<!DOCTYPE html>
<html>
   <head>
      <title>HTML Entities</title>
   </head>
   <body>
      <div id = "character">
   </body>
</html>

HTML 4.0中还有一长串特殊字符。 为了使它们出现在您的文档中,您可以使用数字代码或实体名称。 例如,要插入版权符号,您可以使用以下任一项 -

© 2007
or
© 2007

ISO 8859-1符号实体

结果描述实体名称数字代码
non-breaking space&nbsp; 
¡inverted exclamation mark&iexcl;¡
¤currency&curren;¤
¢cent&cent;¢
£pound&pound;£
¥yen&yen;¥
¦broken vertical bar&brvbar;¦
§section&sect;§
¨spacing diaeresis&uml;¨
©copyright&copy;©
ªfeminine ordinal indicator&ordf;ª
«angle quotation mark (left)&laquo;«
¬negation&not;¬
­soft hyphen&shy;­
®注册商标&reg;®
trademark&trade;
¯spacing macron&macr;¯
°degree&deg;°
±plus-or-minus &plusmn;±
²上标2&sup2;²
³上标3&sup3;³
´spacing acute&acute;´
µmicro&micro;µ
paragraph&para;
·中间点&middot;·
¸spacing cedilla&cedil;¸
¹上标1&sup1;¹
ºmasculine ordinal indicator&ordm;º
»angle quotation mark (right)&raquo;»
¼fraction 1/4&frac14;¼
½fraction 1/2&frac12;½
¾fraction 3/4&frac34;¾
¿inverted question mark&iquest;¿
×乘法&times;×
÷division&divide;÷

ISO 8859-1字符实体

结果描述实体名称数字代码
Àcapital a, grave accent&Agrave;À
Ácapital a, acute accent&Aacute;Á
Âcapital a, circumflex accent&Acirc;Â
Ãcapital a, tilde&Atilde;Ã
Äcapital a, umlaut mark&Auml;Ä
Åcapital a, ring&Aring;Å
Æcapital ae&AElig;Æ
Çcapital c, cedilla&Ccedil;Ç
Ècapital e, grave accent&Egrave;È
Écapital e, acute accent&Eacute;É
Êcapital e, circumflex accent&Ecirc;Ê
Ëcapital e, umlaut mark&Euml;Ë
Ìcapital i, grave accent&Igrave;Ì
Ícapital i, acute accent&Iacute;Í
Îcapital i, circumflex accent&Icirc;Î
Ï资本i,umlaut mark&Iuml;Ï
Ðcapital eth, Icelandic&ETH;Ð
Ñcapital n, tilde&Ntilde;Ñ
Òcapital o, grave accent&Ograve;Ò
Ócapital o, acute accent&Oacute;Ó
Ôcapital o, circumflex accent&Ocirc;Ô
Õcapital o, tilde&Otilde;Õ
Öcapital o, umlaut mark&Ouml;Ö
Øcapital o, slash&Oslash;Ø
Ùcapital u, grave accent&Ugrave;Ù
Úcapital u, grave accent&Uacute;Ú
Ûcapital u, circumflex accent&Ucirc;Û
Ücapital u, umlaut mark&Uuml;Ü
Ýcapital y, acute accent&Yacute;Ý
Þcapital THORN, Icelandic&THORN;Þ
ßsmall sharp s, German&szlig;ß
àsmall a, grave accent&agrave;à
ásmall a, acute accent&aacute;á
âsmall a, circumflex accent&acirc;â
ãsmall a, tilde&atilde;ã
äsmall a, umlaut mark&auml;ä
åsmall a, ring&aring;å
æ小ae&aelig;æ
çsmall c, cedilla&ccedil;ç
èsmall e, grave accent&egrave;è
ésmall e, acute accent&eacute;é
êsmall e, circumflex accent&ecirc;ê
ësmall e, umlaut mark&euml;ë
ìsmall i, grave accent&igrave;ì
ísmall i, acute accent&iacute;í
îsmall i, circumflex accent&icirc;î
ïsmall i, umlaut mark&iuml;ï
ðsmall eth, Icelandic&eth;ð
ñsmall n, tilde&ntilde;ñ
òsmall o, grave accent&ograve;ò
ósmall o, acute accent&oacute;ó
ôsmall o, circumflex accent&ocirc;ô
õsmall o, tilde&otilde;õ
ösmall o, umlaut mark&ouml;ö
øsmall o, slash&oslash;ø
ùsmall u, grave accent&ugrave;ù
úsmall u, acute accent&uacute;ú
ûsmall u, circumflex accent&ucirc;û
üsmall u, umlaut mark&uuml;ü
ýsmall y, acute accent&yacute;ý
þsmall thorn, Icelandic&thorn;þ
ÿsmall y, umlaut mark&yuml;ÿ

HTML浏览器支持的其他实体

结果描述实体名称数字代码
Œcapital ligature OE&OElig;Œ
œsmall ligature oe&oelig;œ
Šcapital S with caron&Scaron;Š
šsmall S with caron&scaron;š
Ÿcapital Y with diaeres&Yuml;Ÿ
ˆmodifier letter circumflex accent&circ;ˆ
˜小波浪&tilde;˜
en space&ensp;
em space&emsp;
thin space&thinsp;
零宽度非连接器&zwnj;
zero width joiner&zwj;
从左到右的标记&lrm;
从右到左的标记&rlm;
en dash&ndash;
em dash&mdash;
left single quotation mark&lsquo;
right single quotation mark&rsquo;
single low-9 quotation mark&sbquo;
left double quotation mark&ldquo;
right double quotation mark&rdquo;
double low-9 quotation mark&bdquo;
dagger&dagger;
Double dagger&Dagger;
horizontal ellipsis&hellip;
per mille&permil;
single left-pointing angle quotation&lsaquo;
single right-pointing angle quotation&rsaquo;
euro&euro;