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. Qt Installer Framework的学习

    Qt Installer Framework是Qt默认包的发布框架.它很方便,使用静态编译Qt制作而成.并且使用了压缩率很高的7z对组件进行压缩.之所以有这些好处,我才觉得值得花一点儿精力研究一下这个 ...

  2. 【Eclipse】Tomcat 一直处于starting状态,项目却已成功启动

    是因为Eclipse里面设置了代理.preference-network connections-activity provider-direct-应用.重启tomcat即可.

  3. iOS开发之自定义导航栏返回按钮右滑返回手势失效的解决

    我相信针对每一个iOS开发者来说~除了根视图控制器外~所有的界面通过导航栏push过去的界面都是可以通过右滑来返回上一个界面~其实~在很多应用和APP中~用户已经习惯了这个功能~然而~作为开发者的我们 ...

  4. c++,类的组合

    1. 在A类中以B类的对象作为成员变量,称为类的组合(composition). 可以先看看这篇文章理解组合的用处: C++中组合的使用 http://blog.csdn.net/jia_xiaoxi ...

  5. C语言结构体变量内存分配与地址对齐

    地址对齐简单来说就是为了提高访问内存的速度. 数组的地址分配比较简单,由于数据类型相同,地址对齐是一件自然而然的事情. 结构体由于存在不同基本数据类型的组合,所以地址对齐存在不同情况,但总体来说有以下 ...

  6. [HDU 4842]--过河(dp+状态压缩)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4842 过河 Time Limit: 3000/1000 MS (Java/Others)    Mem ...

  7. C#实现时间戳转化

    /// <summary> /// 时间戳转为C#格式时间 /// </summary> /// <param name=”timeStamp”></para ...

  8. Week13(12月2日):又到了那个点,期末了~~~~

    Part I:提问 =========================== 1.ASP.NET MVC是微软.NET平台上的一个(      ). A.语言    B.集成开发环境    C.Web开 ...

  9. OpenBlas编译方法(体验msys下使用MingW)

    OpenBlas是一个优化的Blas库,基于GotoBlas21.13 BSD版,安装步骤如下: Windows下安装: 1. 在SourgeForge下载最新的OpenBlas库:http://so ...

  10. 在springmvc中controller的一个方法处理多个不同请求

    value的uri值为以下三类: A) 可以指定为普通的具体值: B)  可以指定为含有某变量的一类值(URI Template Patterns with Path Variables): @Req ...