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. C++堆和栈的比较(7个区别)

    基础知识: 堆 栈是一种简单的数据结构,是一种只允许在其一端进行插入或删除的线性表.允许插入或删除操作的一端称为栈顶,另一端称为栈底,对堆栈的插入和删除操作被称 为入栈和出栈.有一组CPU指令可以实现 ...

  2. PHP - 抓取电视剧资源

    <?php /** * 获取下载url * @return [type] [description] */ function getVedioDwonloadUrl() { for ($i=1; ...

  3. MYSQL - php 使用 localhost 无法连接数据库

    php 使用 localhost 无法连接数据库,而使用127.0.0.1却能连接成功. 可能原因: 系统hosts文件未提供127.0.0.1到localhost的解析.解决方法(以win7系统为例 ...

  4. [Swust OJ 179]--火柴棍(找规律)

    题目链接:http://acm.swust.edu.cn/problem/0179/ Time limit(ms): 1000 Memory limit(kb): 65535   Descriptio ...

  5. [转]Centos6.5安装配置keepalived

    参考博文: Centos6.5安装配置keepalived CentOS6.5 keepalived详解及实现Nginx服务的高可用性 CentOS6.5 LVS + KeepAlived搭建步骤 我 ...

  6. 笔记之Cyclone IV 第一卷第二章Cyclone IV器件的逻辑单元和逻辑阵

    逻辑单元 (LE) 在 Cyclone IV 器件结构中是最小的逻辑单位.LE 紧密且有效的提供了高级功能的逻辑使用.每个 LE 有以下特性 ■ 一个四口输入的查找表 (LUT),以实现四种变量的任何 ...

  7. 引用 模块编译Makefile模板

    本文转载自geyingzhen<模块编译Makefile模板>   引用 geyingzhen 的 模块编译Makefile模板 ifneq ($(KERNELRELEASE), ) // ...

  8. sequence2(高精度dp)

    sequence2 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total ...

  9. Sqlite ContentProvider Loader 上下文 对话框

    一.整体工程图 二.activity_main.xml <RelativeLayout xmlns:android="http://schemas.android.com/apk/re ...

  10. Swift实战-QQ在线音乐(第一版)

    //一.*项目准备 1.QQ音乐App 界面素材:(我使用PP助手,将QQ音乐App备份,解压ipa文件 即可得到里面的图片素材) 2.豆瓣电台接口:"http://douban.fm/j/ ...