Complete Guide to Character References in HTML: Meaning, Examples, and Full List
Character references in HTML are used to represent characters that are either reserved for HTML syntax or cannot be represented by normal keyboard input. They are also known as entity references or escape codes. Character references are important for displaying special characters such as copyright symbols, currency symbols, and mathematical symbols.
There are two types of character references in HTML: numeric character references and named character references.
Numeric character references represent characters using their Unicode code point value in decimal or hexadecimal format. For example, the numeric character reference for the euro currency symbol € is € or €. The first one represents the Unicode code point value in decimal format and the second one represents it in hexadecimal format. Similarly, the numeric character reference for the copyright symbol © is © or ©.
Named character references are aliases for numeric character references. They are easier to remember and use than numeric character references. For example, the named character reference for the euro currency symbol is € and for the copyright symbol is ©.
Here are some commonly used character entities along with their name and numeric codes:
&
or&
: Ampersand (&)<
or<
: Less than (<)>
or>
: Greater than (>)"
or"
: Quotation mark (“)'
or'
: Apostrophe (‘)©
or©
: Copyright symbol (©)®
or®
: Registered trademark symbol (®)™
or™
: Trademark symbol (™)
Here are some examples of Character References in HTML:
& or &: Ampersand (&)
> or >: Greater than (>)
" or ": Quotation mark (")
< or <: Less than (<)
' or ': Apostrophe (')
© or ©: Copyright symbol (©)
® or ®: Registered trademark symbol (®)
™ or ™: Trademark symbol (™)
¢ or ¢: Cent sign (¢)
£ or £: Pound sign (£)
¥ or ¥: Yen sign (¥)
€ or €: Euro sign (€)
† or †: Dagger symbol (†)
‡ or ‡: Double dagger symbol (‡)
§ or §: Section sign (§)
¶ or ¶: Pilcrow sign (¶)
• or •: Bullet symbol (•)
… or …: Ellipsis symbol (…)
“ or “: Left double quotation mark (“)
” or ”: Right double quotation mark (”)
The full list of named character references can be found on the W3C website. It includes references for Latin and non-Latin alphabets, mathematical symbols, and various other symbols.
You can find the full list of character references on the W3C website at
https://www.w3.org/TR/html4/sgml/entities.html or
https://www.w3.org/TR/html5/syntax.html#named-character-references.
Using character references is important for ensuring that special characters are displayed correctly in HTML. Failure to use them can result in errors and inconsistencies in the appearance of web pages.
You might also also want to understand html global attributes
In conclusion, Character References in HTML are an important aspect of HTML syntax, allowing special characters to be represented and displayed correctly in web pages. The use of named character references can make it easier to remember and use these codes. By familiarizing oneself with the full list of character references, web developers can ensure that their web pages display correctly across different browsers and platforms.
No comment