Introduction to HTML Emojis
Emojis are icons or stickers used in digital communication. In HTML, emojis are treated as characters from the UTF-8 character set. This means you don't need images to display them; you can use simple character codes.
Why use Emojis?
Emojis add visual interest to your web pages and can convey emotions or concepts quickly. Since they are text-based, they are lightweight and accessible.
How to Display Emojis in HTML
There are three main ways to add emojis to your HTML document:
- Direct Input: Just copy and paste the emoji directly into your code (e.g., 😄). Ensure your meta charset is UTF-8.
- Decimal Entities: Use the
&#decimal;format. For example,😄displays 😄. - Hexadecimal Entities: Use the
&#xhex;format. For example,😄displays 😄.
<p>I am happy 😀</p> <p>I love coding 💻</p> <p>Success! 🚀</p>
Popular Emoji Codes
| Emoji | Decimal | Hex |
|---|---|---|
| 😀 | 😀 | 😀 |
| 🔥 | 🔥 | 🔥 |
| ⭐ | ⭐ | ⭐ |