Symbols

HTML symbols, also known as character entities, such as &lt; for <, represent reserved characters. They begin with & and end with ;, preventing confusion in the browser.

Understanding HTML Symbols

HTML symbols, also referred to as character entities, allow you to display special characters that are either unavailable on a keyboard or have reserved meanings in HTML. Examples include currency symbols like the Rupee (₹) and Euro (€), which can be inserted using specific HTML codes.

Adding Symbols to an HTML Page

To use a symbol in HTML, you need to start with an ampersand (&), followed by the entity name or numeric code, and end with a semicolon (;). This helps prevent conflicts with HTML syntax.

Example Usage

The snippet below shows how to add different symbols using HTML entities:

Copyright: ©

Trademark: ™

Euro: €

index.html
<p>Copyright: &copy;</p>
<p>Trademark: &trade;</p>
<p>Euro: &euro;</p>

Frequently Used Symbols

Registered Trademark: ®

Trademark: ™

Copyright: ©

Left Arrow: ←

index.html
<p>Registered Trademark: &reg;</p>
<p>Trademark: &trade;</p>
<p>Copyright: &copy;</p>
<p>Left Arrow: &larr;</p>

HTML Symbol Representation

Symbols in HTML can be displayed using their entity name, decimal code, or hexadecimal reference.

Example: Displaying the Euro Symbol

Euro Symbol: €

Using Decimal Code: €

Using Hex Code: €

index.html
<p>Euro Symbol: &euro;</p>
<p>Using Decimal Code: &#8364;</p>
<p>Using Hex Code: &#x20AC;</p>

Character Entity Codes

Entities can be represented by named codes or Unicode numbers:

  • &copy; → Copyright symbol (©)
  • &euro; → Euro currency (€)
  • &#8226; → Bullet point (•)
  • &hearts; → Heart (♥)
You can look up a full list of entity codes for different symbols online.

Currency Symbols in HTML

Here’s a reference table for common currency symbols and their HTML codes:

SymbolDescriptionEntity NameEntity Number
Indian RupeeNot available&#8377;
Euro&euro;&#8364;
BitcoinNot available&#8383;
¥Japanese Yen&yen;&#165;
Russian RubleNot available&#8381;

Using Decimal & Hexadecimal References

  • Decimal Format: Uses &# followed by a number, e.g., &#9786; (☺).
  • Hexadecimal Format: Uses &#x followed by a hexadecimal code, e.g., &#x263A; (☺).
This method is useful when dealing with Unicode characters.

Displaying Entity Codes with <code>

The <code> element is useful when displaying entity codes in a webpage.

Example

The entity for the copyright symbol is ©

index.html
<p>The entity for the copyright symbol is <code>&copy;</code></p>
Using the <code> tag may alter the appearance due to monospaced fonts.

Conclusion

HTML symbols or character entities enable the inclusion of special characters that are not available on the keyboard or have specific meanings in HTML. These symbols can be represented through named entities, decimal codes, or hexadecimal values. They are crucial for displaying characters like currency symbols and trademarks correctly.