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 cover the most common characters, and are recognized by the majority of browsers. A few examples:
|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||”|
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:
|open circle clockwise arrow||↺|
|right white arrow||⇨|
|vulgar fraction, three-fifths||⅗|
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
> to create those.
The last is the ampersand character, for similar reasons: if you have an & in your document, the browser assumes you are about to start an HTML entity. You have a keyword entity for that too:
Enjoy this piece? I invite you to follow me at twitter.com/dudleystorey to learn more.