There are two primary methods of generating a character with HTML entities: that is, two ways of generating characters that your keyboard and/or a word processor does not produce by default. Both methods start with an ampersand character (&) and end with a semi-colon. They are keyword and decimal entities.
Keyword entities
Keyword entities cover the most common characters, and are recognized by the majority of browsers. A few examples:
| Keyword | Meaning | Produces |
|---|---|---|
© | copyright symbol | © |
™ | trademark symbol | ™ |
° | degree | ° |
&mash; | a long dash – to separate two conjoined pieces of text | – |
‐ | a short dash or hyphen - to join words or dates (e.g. 1939-45) | – |
“ | a leading quotation mark | “ |
” | a closing quotation mark | ” |
″ | inches, seconds | ″ |
′ | feet, minutes | ′ |
¾ | three-quarters | ¾ |
Decimal entities
Not every character has a keyword entity: the number of possible characters and symbols from every language is simply too great. Every character is also given a decimal entity: a code written in numbers. Sometimes these have keyword entity equivalents, but often not. Successful glyph representation is often more sensitive to font, browser, and OS selection. A minute sampling:
| Code | Meaning | Produces |
|---|---|---|
↺ | open circle clockwise arrow | ↺ |
⇨ | right white arrow | ⇨ |
⅗ | vulgar fraction, three-fifths | ⅗ |
№ | numero sign | № |
Ω | ohm | Ω |
A few oddities
There are a few characters that remain problematic. The first two are the greater and less than sign: when you use < or > in a web page, the browser will assume that you are starting about the start or end of a tag. Use the keyword entities < and > to create those.
The last is the ampersand character, for similar reasons – if we have an & in our document, the browser assumes we are going to start an HTML entity. You have a keyword entity for that too: &
Pro CSS3 Animation, Apress, 2013