HTML Entities

Some characters are reserved in HTML.

It is not possible to use the less than (<) or greater than (>) signs in your text, because the browser will mix them with tags.

To actually display reserved characters, we must use character entities in the HTML source code.

A character entity looks like this:

&entity_name;

OR

&#entity_number;

To display a less than sign we must write: &lt; or <

 Tip: The advantage of using an entity name, instead of a number, is that the name is easier
to remember. However, the disadvantage is that browsers may not support all entity names (the support for entity numbers is very good).


Non-breaking Space

A common character entity used in HTML is the non-breaking space (&nbsp;).

Browsers will always truncate spaces in HTML pages. If you write 10 spaces in your text, the browser will remove 9 of them, before displaying the page. To add spaces to your text, you can use the &nbsp; character entity.


HTML Entities Example

Experiment with HTML character entities: 

filename=tryhtml_entities" style="line-height:21px; text-decoration:none; color:rgb(144,11,9); background-color:transparent">Try
it yourself


HTML Useful Character Entities

Note: Entity names are case sensitive!

Result Description Entity Name Entity Number
  non-breaking space &nbsp;  
< less than &lt; <
> greater than &gt; >
& ampersand &amp; &
? cent &cent; ¢
?

pound &pound; £
?

yen &yen; ¥
?

euro &euro;
§ section &sect; §
? copyright &copy; ©
? registered trademark &reg; ®
? trademark &trade;

For a complete reference of all character entities, visit our HTML Entities
Reference
.

HTML ISO-8859-1 Reference


Modern browsers supports several character-sets:


ISO-8859-1

ISO-8859-1 is the default character set in most browsers.

The first 128 characters of ISO-8859-1 is the original ASCII character-set (the numbers from 0-9, the uppercase and lowercase English alphabet, and some special characters).

The higher part of ISO-8859-1 (codes from 160-255) contains the characters used in Western European countries and some commonly used special characters.

Entities are used to implement reserved characters or to express characters that cannot easily be entered with the keyboard.


Reserved Characters in HTML

Some characters are reserved in HTML and XHTML. For example, you cannot use the greater than or less than signs within your text because the browser could mistake them for markup.

HTML and XHTML processors must support the five special characters listed in the table below:

Character Entity Number Entity Name Description
" " &quot; quotation mark
' ' &apos; apostrophe 
& & &amp; ampersand
< < &lt; less-than
> > &gt; greater-than

Note: Entity names are case sensitive!


ISO 8859-1 Symbols

Character Entity Number Entity Name Description
    &nbsp; non-breaking space
? ¡ &iexcl; inverted exclamation mark
? ¢ &cent; cent
? £ &pound; pound
¤ ¤ &curren; currency
? ¥ &yen; yen
? ¦ &brvbar; broken vertical bar
§ § &sect; section
¨ ¨ &uml; spacing diaeresis
? © &copy; copyright
? ª &ordf; feminine ordinal indicator
? « &laquo; angle quotation mark (left)
? ¬ &not; negation
  ­ &shy; soft hyphen
? ® &reg; registered trademark
? ¯ &macr; spacing macron
° ° &deg; degree
± ± &plusmn; plus-or-minus 
? ² &sup2; superscript 2
?

³ &sup3; superscript 3
?

´ &acute; spacing acute
? µ &micro; micro
?

&para; paragraph
· · &middot; middle dot
?

¸ &cedil; spacing cedilla
?

¹ &sup1; superscript 1
?

º &ordm; masculine ordinal indicator
? » &raquo; angle quotation mark (right)
? ¼ &frac14; fraction 1/4
?

½ &frac12; fraction 1/2
?

¾ &frac34; fraction 3/4
? ¿ &iquest; inverted question mark
× × &times; multiplication
÷ ÷ &divide; division

ISO 8859-1 Characters

Character Entity Number Entity Name Description
? À &Agrave; capital a, grave accent
?

Á &Aacute; capital a, acute accent
? Â &Acirc; capital a, circumflex accent
? Ã &Atilde; capital a, tilde
? Ä &Auml; capital a, umlaut mark
?

Å &Aring; capital a, ring
? Æ &AElig; capital ae
?

Ç &Ccedil; capital c, cedilla
?

È &Egrave; capital e, grave accent
? É &Eacute; capital e, acute accent
?

Ê &Ecirc; capital e, circumflex accent
? Ë &Euml; capital e, umlaut mark
? Ì &Igrave; capital i, grave accent
? Í &Iacute; capital i, acute accent
? Î &Icirc; capital i, circumflex accent
?

Ï &Iuml; capital i, umlaut mark
?

Ð &ETH; capital eth, Icelandic
? Ñ &Ntilde; capital n, tilde
? Ò &Ograve; capital o, grave accent
? Ó &Oacute; capital o, acute accent
?

Ô &Ocirc; capital o, circumflex accent
? Õ &Otilde; capital o, tilde
? Ö &Ouml; capital o, umlaut mark
?

Ø &Oslash; capital o, slash
?

Ù &Ugrave; capital u, grave accent
? Ú &Uacute; capital u, acute accent
? Û &Ucirc; capital u, circumflex accent
? Ü &Uuml; capital u, umlaut mark
? Ý &Yacute; capital y, acute accent
? Þ &THORN; capital THORN, Icelandic
? ß &szlig; small sharp s, German
à à &agrave; small a, grave accent
á á &aacute; small a, acute accent
? â &acirc; small a, circumflex accent
?

ã &atilde; small a, tilde
?

ä &auml; small a, umlaut mark
? å &aring; small a, ring
? æ &aelig; small ae
?

ç &ccedil; small c, cedilla
è è &egrave; small e, grave accent
é é &eacute; small e, acute accent
ê ê &ecirc; small e, circumflex accent
?

ë &euml; small e, umlaut mark
ì ì &igrave; small i, grave accent
í í &iacute; small i, acute accent
? î &icirc; small i, circumflex accent
?

ï &iuml; small i, umlaut mark
? ð &eth; small eth, Icelandic
? ñ &ntilde; small n, tilde
ò ò &ograve; small o, grave accent
ó ó &oacute; small o, acute accent
?

ô &ocirc; small o, circumflex accent
?

õ &otilde; small o, tilde
?

ö &ouml; small o, umlaut mark
?

ø &oslash; small o, slash
ù ù &ugrave; small u, grave accent
ú ú &uacute; small u, acute accent
? û &ucirc; small u, circumflex accent
ü ü &uuml; small u, umlaut mark
? ý &yacute; small y, acute accent
? þ &thorn; small thorn, Icelandic
?

ÿ &yuml; small y, umlaut mark

HTML - HTML Commonly Used Character Entities的更多相关文章

  1. HTML字符实体(Character Entities),转义字符串(Escape Sequence)

    为什么要用转义字符串? HTML中<,>,&等有特殊含义(<,>,用于链接签,&用于转义),不能直接使用.这些符号是不显示在我们最终看到的网页里的,那如果我们希 ...

  2. HTML字符实体(Character Entities),转义字符串(Escape Sequence)【转】

    为什么要用转义字符串? HTML中<,>,&等有特殊含义(<,>,用于链接签,&用于转义),不能直接使用.这些符号是不显示在我们最终看到的网页里的,那如果我们希 ...

  3. HTML字符实体(Character Entities),转义字符串(Escape Sequence) 转

    为什么要用转义字符串? HTML中<,>,&等有特殊含义(<,>,用于链接签,&用于转义),不能直接使用.这些符号是不显示在我们最终看到的网页里的,那如果我们希 ...

  4. [转]HTML字符实体(Character Entities),转义字符串(Escape Sequence)

    为什么要用转义字符串? HTML中<,>,&等有特殊含义(<,>,用于链接签,&用于转义),不能直接使用.这些符号是不显示在我们最终看到的网页里的,那如果我们希 ...

  5. HTML字符实体(Character Entities)与 转义字符串(Escape Sequence)(转)

    为什么要用转义字符串?HTML中<,>,&等有特殊含义(<,>,用于链接签,&用于转义),不能直接使用.这些符号是不显示在我们最终看到的网页里的,那如果我们希望 ...

  6. List of XML and HTML character entity references

    A character entity reference refers to the content of a named entity. An entity declaration is creat ...

  7. 【译】DTD - Entities

    原文:DTD - Entities 实体用于定义XML文档中特殊字符的快捷方式. 实体主要有四种类型: 内置实体(Built-in entities) 字符实体(Character entities) ...

  8. SCALA XML pattern attrbute(属性)

    from: Working with Scala's XML Support 虽然这个guy炒鸡罗嗦,但是还是讲到我要的那句话:  Because Scala doesn't support XML ...

  9. java转换 HTML字符实体,java特殊字符转义字符串

    为什么要用转义字符串? HTML中<,>,&等有特殊含义(<,>,用于链接签,&用于转义),不能直接使用.这些符号是不显示在我们最终看到的网页里的,那如果我们希 ...

随机推荐

  1. centos7 在 vmware下的安装与配置

    我们这里选择的centos7的版本是  CentOS-7-x86_64-DVD-1511.iso 在vmware下安装,碰到两个问题: 1)安装如下界面时,会发现“开始安装”按钮是灰化的,这时需要对有 ...

  2. gzip解压压缩的字符串数据

    import urllib2 from StringIO import StringIO import gzip def loadData(url): request = urllib2.Reques ...

  3. 学校作业-Dp练习

    题目 ★Stringsobits01 串  考虑排好序的 N(N<=31)位二进制数.  你会发现,这很有趣.因为他们是排列好的,而且包含所有可能的长度为 N 且含有 1 的个数小于等于 L(L ...

  4. 数据结构——表(list)

    #include <iostream> #include <list> using namespace std; 标准类的存储方式为双向循环链表 list类 class lis ...

  5. SEOR要懂得如何建立完善的seo运营团队

    网站运营要想能做大做全面,完善的seo运营团队是不可缺少的,跟企业管理一样的道理,seo运营的成功也在于对团队的合理利用,发挥团队中每个成员的优势才能运营好网站.网站的运营CEO要懂得如何建立完善的s ...

  6. 【Maven】运行项目,报ClassNotFound错误

    我们在pom.xml中添加了那些依赖的jar后,一旦在代码中应用.当我们本地调试时,会报ClassNotFound错误,这是为什么?? 因为Tomcat不懂这些配置,你必须把Maven Depende ...

  7. 字符设备驱动4: ioremap

    #define GPIO_OFT(x) ((x) - 0x56000000)#define GPFCON (*(volatile unsigned long *)(gpio_va + GPIO_OFT ...

  8. c/c++字符数组和字符串大揭秘

    第一:写这篇文章源于我对'\0'和“\0”的探讨 当我对char a []="\0"; int size_a=sizeof(a); //结果为2 当时我很纳闷字符串不是以'\0'结 ...

  9. Android 使用 array.xml

    //获取文件资源 TypedArray mainNavIcon = context.getResources().obtainTypedArray(R.array.mainNavIcon); //获取 ...

  10. USACO Longest Prefix 【水】

    用Dp的思想解决了这道题目,也就是所谓的暴力= = 题意:给出一个集合,一个字符串,找出这个字符串的最长前缀,使得前缀可以划分为这个集合中的元素(集合中的元素可以不全部使用). 还不会Trie 树QA ...