CSS and HTML entities

Definition.

Some characters are problematic because they conflict with the syntax of HTML or CSS. This is the typical case of the lower sign ( < ). In these very special cases, you must use an entity, i.e. a code that will be displayed by the browser as the desired character.

Entity codes always start with the ampersand character (&) and end with a semicolon. Between the two you can specify either the name of the entity when it exists, or the character code. The following three syntaxes are valid:

  • The name of the entity: &lt; to display <.
  • The decimal code of the character: &#65; to display A.
  • The hexadecimal code of the character: &#x41; to display A.

Essential entities.

These entities are to be known, either because the character they represent conflicts with the HTML or CSS syntax, and therefore cannot be use it directly, or because the character is not on the keyboards.

  • < and > which are the characters used in HTML syntax to identify tags.
  • & the character used to introduce an entity. It is itself forbidden.
  • The hyphen. This character marks where a word can be hyphe­nated at the end of a line. It is invi­sible if the word is not cut. Vary the width of your browser window and observe how work hyphe­nation included in this sentence.
  • The white non-breakable. This character, which is displayed as a space, does not allow for line breaks at this point. Vary the width of your browser window and observe that the number 1,000,000 € is never separated from its unit symbols.
  • Finally, enlarged or narrowed spaces can also be useful:
        &ensp; is an expanded space.
        &emsp; is a very expanded spacce.
        &thinsp; is a small space.
<
&lt;
>
&gt;
&
&amp;
-
&shy;
 
&nbsp;

&ensp;

&emsp;

&thinsp;

Accents and diacritical letters.

Accent entities can be used on their own, but this is rare. They are used more in addition to a letter.
For example &circ; is the circumflex accent; by writing &ocirc; we obtain an ô. For the capital Ô, simply write &Ocirc;.

Note: The cedilla and the bar below have a function comparable to that of accents.

´
&acute;
`
&grave;
ˆ
&circ;
ˇ
&caron;
ˇ
&Hacek;
˘
&breve;
˙
&dot;
˚
&ring;
˛
&ogon;
˜
&tilde;
˝
&dblac;
̑
&DownBreve;
_
&UnderBar;

Ligatured letters.

Some pairs of letters can be replaced by a single character, which is more legible or more aesthetically pleasing.

œ
&oelig;
Œ
&OElig;
æ
&aelig;
Æ
&AElig;

&fflig;

&filig;

&ffilig;

&ffllig;

&fllig;

&ffilig;

&ffllig;
ij
&ijlig;
IJ
&IJlig;
ß
&szlig;

More...

Currency symbols.


&euro;
$
&dollar;
¥
&yen;
¢
&cent;
¤
&curren;
£
&pound;

Some symbols in common use.

±
&plusmn;
µ
&micro;
©
&copy;
®
&reg;

&trade;
«
&laquo;
»
&raquo;

&lsquo;

&rsquo;

&ldquo;

&rdquo;

&prime;

&Prime;

&tprime;

&numero;
ª
&ordf;
º
&ordm;
¹
&sup1;
²
&sup2;
³
&sup3;
½
&frac12;

&frac13;
¼
&frac14;

&frac15;

&frac16;

&frac18;

&frac23;

&frac25;
¾
&frac34;

&frac35;

&frac38;

&frac45;

&frac56;

&frac58;

&frac78;

&permil;

&pertenk;

&bullet;
·
&middot;

&squarf;

&rtrif;

&star;

&Star;

&spades;

&clubs;

&hearts;

&diams;

&phone;

&female;

&male;

&sung;

&flat;

&sharp;

&natural;

More...

Greek alphabet.

Greek letters all have an entity corresponding to them.

α
&alpha;
β
&beta;
γ
&gamma;
δ
&delta;
ε
&epsilon;
ζ
&zeta;
η
&eta;
θ
&theta;
ι
&iota;
κ
&kappa;
λ
&lambda;
μ
&mu;
ν
&nu;
ξ
&xi;
ο
&omicron;
π
&pi;
ρ
&rho;
ς
&sigmaf;
σ
&sigma;
τ
&tau;
υ
&upsilon;
φ
&phi;
χ
&chi;
ψ
&psi;
ω
&omega;
ϑ
&thetasym;
ϒ
&upsih;
ϖ
&piv;
Α
&Alpha;
Β
&Beta;
Γ
&Gamma;
Δ
&Delta;
Ε
&Epsilon;
Ζ
&Zeta;
Η
&Eta;
Θ
&Theta;
Ι
&Iota;
Κ
&Kappa;
Λ
&Lambda;
Μ
&Mu;
Ν
&Nu;
Ξ
&Xi;
Ο
&Omicron;
Π
&Pi;
Ρ
&Rho;
Σ
&Sigma;
Τ
&Tau;
Υ
&Upsilon;
Φ
&Phi;
Χ
&Chi;
Ψ
&Psi;
Ω
&Omega;

See all
alphabet

Mathematical Symbols.


&sum;

&radic;

&infin;

&sim;

&asymp;

&ne;

&le;

&ge;

&int;

&int;

&int;

&conint;

&Conint;

&Cconint;

&cong;

&equiv;

More...

Arrows0.

There are really a lot of arrows, of all kinds. Here are a few of them.


&uarr;

&rarr;

&darr;

&larr;

&harr;

&varr;

&crarr;

&uArr;

&rArr;

&dArr;

&lArr;

&hArr;

&vArr;

&lbarr;

&rbarr;

&lBarr;

&rBarr;

&rarrfs;

&larrfs;

More...

All entities.

For a complete list of all standards-based entities, see at site of the W3C.