There is so much text on so many webpages across the web, and some of this text happens to be special characters that do not appear on a keyboard. How then, to go about including such characters on webpages?
This tutorial focuses on:
- What is an entity?
- Entity construction
- Common entities
- Reverse entities
What is an entity?
An entity is a symbol that is displayed on a webpage such as the copyright symbol ( � ), the trademark symbol (�), and the ampersand symbol (&). Each entity is displayed using a special code.
Now that you what entities are, how do you go displaying them?
An HTML entity code has three parts:
- An ampersand ( & )
- An entity name or a # sign and an entity number
- A semicolon ( ; )
For example, to display a greater than sign on a webpage, we would write > or >
Here it is again - >
NOTE: While you can use names or numbers for character entities, it is better to use names because they are easier to remember.
NOTE: Entities are case sensitive!
There are many entities you can use, the ones below are very commonly used.
Common character entities and what they will display:
|Entity Name||Entity Number||Character||Output|
| || ||space|
|<||<||less than sign||<|
|>||>||greater than sign||>|
For a full list of HTML character entities, read our HTML character entities reference page.
What if you wanted to print the code for an entity on a webpage instead of the character itself?
Remember that every entity begins with the & symbol, and how do we display this symbol? By using the & entity. So to display the code for an entity on a webpage instead of the character itself, simply use & to produce an & symbol followed by the rest of the entity code.