HTML - HTML Commonly Used Character Entities

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 &#60;

Remark 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: Try it yourself


HTML Useful Character Entities

Note: Entity names are case sensitive!

Result Description Entity Name Entity Number
  non-breaking space &nbsp; &#160;
< less than &lt; &#60;
> greater than &gt; &#62;
& ampersand &amp; &#38;
? cent &cent; &#162;
? pound &pound; &#163;
? yen &yen; &#165;
? euro &euro; &#8364;
§ section &sect; &#167;
? copyright &copy; &#169;
? registered trademark &reg; &#174;
? trademark &trade; &#8482;

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
" &#34; &quot; quotation mark
' &#39; &apos; apostrophe 
& &#38; &amp; ampersand
< &#60; &lt; less-than
> &#62; &gt; greater-than

Note: Entity names are case sensitive!


ISO 8859-1 Symbols

Character Entity Number Entity Name Description
  &#160; &nbsp; non-breaking space
? &#161; &iexcl; inverted exclamation mark
? &#162; &cent; cent
? &#163; &pound; pound
¤ &#164; &curren; currency
? &#165; &yen; yen
? &#166; &brvbar; broken vertical bar
§ &#167; &sect; section
¨ &#168; &uml; spacing diaeresis
? &#169; &copy; copyright
? &#170; &ordf; feminine ordinal indicator
? &#171; &laquo; angle quotation mark (left)
? &#172; &not; negation
  &#173; &shy; soft hyphen
? &#174; &reg; registered trademark
? &#175; &macr; spacing macron
° &#176; &deg; degree
± &#177; &plusmn; plus-or-minus 
? &#178; &sup2; superscript 2
? &#179; &sup3; superscript 3
? &#180; &acute; spacing acute
? &#181; &micro; micro
? &#182; &para; paragraph
· &#183; &middot; middle dot
? &#184; &cedil; spacing cedilla
? &#185; &sup1; superscript 1
? &#186; &ordm; masculine ordinal indicator
? &#187; &raquo; angle quotation mark (right)
? &#188; &frac14; fraction 1/4
? &#189; &frac12; fraction 1/2
? &#190; &frac34; fraction 3/4
? &#191; &iquest; inverted question mark
× &#215; &times; multiplication
÷ &#247; &divide; division

ISO 8859-1 Characters

Character Entity Number Entity Name Description
? &#192; &Agrave; capital a, grave accent
? &#193; &Aacute; capital a, acute accent
? &#194; &Acirc; capital a, circumflex accent
? &#195; &Atilde; capital a, tilde
? &#196; &Auml; capital a, umlaut mark
? &#197; &Aring; capital a, ring
? &#198; &AElig; capital ae
? &#199; &Ccedil; capital c, cedilla
? &#200; &Egrave; capital e, grave accent
? &#201; &Eacute; capital e, acute accent
? &#202; &Ecirc; capital e, circumflex accent
? &#203; &Euml; capital e, umlaut mark
? &#204; &Igrave; capital i, grave accent
? &#205; &Iacute; capital i, acute accent
? &#206; &Icirc; capital i, circumflex accent
? &#207; &Iuml; capital i, umlaut mark
? &#208; &ETH; capital eth, Icelandic
? &#209; &Ntilde; capital n, tilde
? &#210; &Ograve; capital o, grave accent
? &#211; &Oacute; capital o, acute accent
? &#212; &Ocirc; capital o, circumflex accent
? &#213; &Otilde; capital o, tilde
? &#214; &Ouml; capital o, umlaut mark
? &#216; &Oslash; capital o, slash
? &#217; &Ugrave; capital u, grave accent
? &#218; &Uacute; capital u, acute accent
? &#219; &Ucirc; capital u, circumflex accent
? &#220; &Uuml; capital u, umlaut mark
? &#221; &Yacute; capital y, acute accent
? &#222; &THORN; capital THORN, Icelandic
? &#223; &szlig; small sharp s, German
à &#224; &agrave; small a, grave accent
á &#225; &aacute; small a, acute accent
? &#226; &acirc; small a, circumflex accent
? &#227; &atilde; small a, tilde
? &#228; &auml; small a, umlaut mark
? &#229; &aring; small a, ring
? &#230; &aelig; small ae
? &#231; &ccedil; small c, cedilla
è &#232; &egrave; small e, grave accent
é &#233; &eacute; small e, acute accent
ê &#234; &ecirc; small e, circumflex accent
? &#235; &euml; small e, umlaut mark
ì &#236; &igrave; small i, grave accent
í &#237; &iacute; small i, acute accent
? &#238; &icirc; small i, circumflex accent
? &#239; &iuml; small i, umlaut mark
? &#240; &eth; small eth, Icelandic
? &#241; &ntilde; small n, tilde
ò &#242; &ograve; small o, grave accent
ó &#243; &oacute; small o, acute accent
? &#244; &ocirc; small o, circumflex accent
? &#245; &otilde; small o, tilde
? &#246; &ouml; small o, umlaut mark
? &#248; &oslash; small o, slash
ù &#249; &ugrave; small u, grave accent
ú &#250; &uacute; small u, acute accent
? &#251; &ucirc; small u, circumflex accent
ü &#252; &uuml; small u, umlaut mark
? &#253; &yacute; small y, acute accent
? &#254; &thorn; small thorn, Icelandic
? &#255; &yuml; small y, umlaut mark
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章