HTML Introduction | HTML Text Elements | Entity
HTML has several predefined characters. These are called HTML reserved characters. If you use these reserved characters directly in HTML code, the web browser interprets them with a special meaning instead of their normal character meaning. An entity is a separately defined character set that lets you display HTML reserved characters with their original meaning.
An entity has the following form.
Syntax
&entityName;
or
&#entityNumber;
The following example shows how a web browser interprets angle brackets (<>) when they are used in HTML code.
Example
<p><h2> is a tag that represents the second-largest heading.</p>
<p><p> is a tag that represents a paragraph.</p>
As shown above, angle brackets (<>) used in HTML code are interpreted as the start and end of an HTML tag.
Entity names are case-sensitive.
Common entities provided by HTML are as follows.
| Entity character | Entity name | Hex entity number | Description |
|---|---|---|---|
| |   | non-breaking space | |
< |
< | < | less than |
> |
> | > | greater than |
& |
& | & | ampersand |
" |
" | " | double quotation mark |
' |
' | ' | single quotation mark |
For more information about all entities available in HTML, see the official W3C site.
Character entity references in HTML
Diacritical marks
A mark that indicates pronunciation is called an accent. These accents are not used on their own. They are usually used together with another character. To represent them accurately, HTML provides separate diacritical marks like the following.
Common diacritical marks provided by HTML are as follows.
| Diacritical mark | Character | Hex entity | Result |
|---|---|---|---|
| ̀ | a | à | à |
| ́ | a | á | á |
| ̂ | a | â | â |
| ̃ | a | ã | ã |
| ̀ | O | Ò | Ò |
| ́ | O | Ó | Ó |
| ̂ | O | Ô | Ô |
| ̃ | O | Õ | Õ |
Example
<p>The pronunciation symbol for j with an accent is [j́].</p>
Symbol special characters
In addition to HTML reserved words, you can use symbol special characters to represent characters that cannot be typed from the keyboard. These symbol special characters include mathematical terms, Greek letters, and international currencies.
Common symbol special characters provided by HTML are as follows.
| Symbol special character | Entity name | Hex entity | Description |
|---|---|---|---|
| ¢ | ¢ | ¢ | cent |
| £ | £ | £ | pound sterling |
| ¥ | ¥ | ¥ | yen |
| € | € | € | euro |
| © | © | © | copyright |
| ® | ® | ® | registered trademark |
| × | × | × | multiplication |
| ÷ | ÷ | ÷ | division |