HTML Symbols refer to the special characters that have a particular meaning in HTML and cannot be directly used in HTML documents. To display these symbols, we use their corresponding entity names or numbers. Here’s an article that will explain HTML Symbols with syntax and examples.
HTML Symbol Syntax: The syntax for HTML symbols is as follows:
- For entity names, use the ‘&’ symbol followed by the entity name and ending with a ‘;’
- For entity numbers, use the ‘&#’ symbol followed by the entity number and ending with a ‘;’
Here are some commonly used HTML symbols with their entity names and numbers:
Symbol | Entity Name | Entity Number
& | & | & < | < | <
| > | >
” | ” | ” ‘ | ‘ | ‘ © | © | © ® | ® | ® € | € | € ™ | ™ | ™ ° | ° | ° µ | µ | µ § | § | §
HTML Symbol Examples: Let’s see some examples of how to use HTML Symbols in your HTML code:
- To display a copyright symbol ©, you can use the entity name © or the entity number ©:
<p>This document is © 2023 by John Doe.</p>
Output: This document is © 2023 by John Doe.
- To display a degree symbol °, you can use the entity name ° or the entity number °:
<p>The temperature today is 20°C.</p>
Output: The temperature today is 20°C.
- To display a registered trademark symbol ®, you can use the entity name ® or the entity number ®:
<p>The logo is a registered trademark ® of XYZ Corporation.</p>
Output: The logo is a registered trademark ® of XYZ Corporation.
- To display a euro currency symbol €, you can use the entity name € or the entity number €:
<p>The price of the product is €49.99.</p>
Output: The price of the product is €49.99.
By using HTML Symbols, you can display special characters in your HTML code without worrying about any rendering issues. It’s always a good practice to use symbols in their entity form to ensure that your HTML documents are compatible with all browsers and devices.
Here are some commonly used mathematical symbols and their corresponding HTML entities:
|≤||Less than or equal to|
|≥||Greater than or equal to|
|≠||Not equal to|
|±||Plus or minus|
Using these entities in HTML allows you to display these symbols on your web pages without having to rely on images or other workarounds.