How do i use emojis in css?

Rémy Beumier

Posted on Feb 7, 2020 • Updated on Mar 22, 2021

Emoji's first appeared in 1997 on Japanese mobile phones. They are the descendants of the Emoticons; which are those basic text-based imitation of emotions ;-] – Yes, this is an actual example.

Emoji's grew in popularity years after years by being included in more and more computer, mobile devices, applications, games etc. They are so popular nowadays that they account for a part of the popular culture.

We are using those communication helpers, especially in the younger generations. But how do they work? To stay light, let's say that Emoji's are characters; very much like letters, punctuation marks or symbols.

👽 📞 🏠

Can you find this movie?

How did I integrate those Emoji's into my article? How could I do it anywhere on the web?

We will see different techniques available in HTML, CSS and JavaScript. They rely on two methods; copy-pasting and codepoint.
First find your Emoji, then follow the steps in the language you want.

HTML

The most straightforward way. You can paste the previously chosen Emoji.

🔥

Enter fullscreen mode Exit fullscreen mode

Your other option is to use the codepoint of the Emoji and replacing U+ with &#x.

&#x1F525

Enter fullscreen mode Exit fullscreen mode

CSS

In CSS you need to use the ::before or ::after pseudo-element coupled with the content property where you paste the Emoji as the value.

/* You need an HTML element with the class 'element' */
.element::before {
  content: "🔥";
}

Enter fullscreen mode Exit fullscreen mode

The same way, you can use codepoint replacing U+ with \0.

/* You need an HTML element with the class 'element' */
.element::before {
  content: "\01F525";
}

Enter fullscreen mode Exit fullscreen mode

JavaScript

In JavaScript you need to specify the innerHTML by pasting the Emoji.

/* You need an HTML element with the class 'element' */
document.querySelector[".element"].innerHTML = "🔥";

Enter fullscreen mode Exit fullscreen mode

Similarly, you can use the String method fromCodePoint mixed with the codepoint value where you replace U+ with 0x.

/* You need an HTML element with the class 'element' */
document.querySelector[".element"].innerHTML = String.fromCodePoint[0x1F525];

Enter fullscreen mode Exit fullscreen mode

Live example on Codepen

Isn't an example worth a million words? 😄

All major Browsers support the Emoji's so there is no excuse.
Try it yourself and use Emoji's all over the web!

Keep playing to learn! 🔥

If you find value in what I offer don't hesitate and buy me a coffee 😇

The movie described with Emoji's is E.T.

Note: There are plenty of options to have Emoji's integrated that I am not covering in this article. Icon fonts or SVG's are examples, it's up to you to decide what you will use.

Smiley Emojis For Web.

If you want any of these emojis displayed in HTML, you can use the decimal [dec] or hexadecimal [hex] reference found in the table below.

Example

😜


I will display 😜


I will display 😜

Will display as:

😜

I will display 😜

I will display 😜

Try it Yourself

CharDecHexEntityName
😀 128512 1F600   GRINNING FACE
😁 128513 1F601   GRINNING FACE WITH SMILING EYES
😂 128514 1F602   FACE WITH TEARS OF JOY
😃 128515 1F603   SMILING FACE WITH OPEN MOUTH
😄 128516 1F604   SMILING FACE WITH OPEN MOUTH AND SMILING EYES
😅 128517 1F605   SMILING FACE WITH OPEN MOUTH AND COLD SWEAT
😆 128518 1F606   SMILING FACE WITH OPEN MOUTH AND TIGHTLY-CLOSED EYES
😇 128519 1F607   SMILING FACE WITH HALO
😈 128520 1F608   SMILING FACE WITH HORNS
😉 128521 1F609   WINKING FACE
😊 128522 1F60A   SMILING FACE WITH SMILING EYES
😋 128523 1F60B   FACE SAVOURING DELICIOUS FOOD
😌 128524 1F60C   RELIEVED FACE
😍 128525 1F60D   SMILING FACE WITH HEART-SHAPED EYES
😎 128526 1F60E   SMILING FACE WITH SUNGLASSES
😏 128527 1F60F   SMIRKING FACE
😐 128528 1F610   NEUTRAL FACE
😑 128529 1F611   EXPRESSIONLESS FACE
😒 128530 1F612   UNAMUSED FACE
😓 128531 1F613   FACE WITH COLD SWEAT
😔 128532 1F614   PENSIVE FACE
😕 128533 1F615   CONFUSED FACE
😖 128534 1F616   CONFOUNDED FACE
😗 128535 1F617   KISSING FACE
😘 128536 1F618   FACE THROWING A KISS
😙 128537 1F619   KISSING FACE WITH SMILING EYES
😚 128538 1F61A   KISSING FACE WITH CLOSED EYES
😛 128539 1F61B   FACE WITH STUCK-OUT TONGUE
😜 128540 1F61C   FACE WITH STUCK-OUT TONGUE AND WINKING EYE
😝 128541 1F61D   FACE WITH STUCK-OUT TONGUE AND TIGHTLY-CLOSED EYES
😞 128542 1F61E   DISAPPOINTED FACE
😟 128543 1F61F   WORRIED FACE
😠 128544 1F620   ANGRY FACE
😡 128545 1F621   POUTING FACE
😢 128546 1F622   CRYING FACE
😣 128547 1F623   PERSEVERING FACE
😤 128548 1F624   FACE WITH LOOK OF TRIUMPH
😥 128549 1F625   DISAPPOINTED BUT RELIEVED FACE
😦 128550 1F626   FROWNING FACE WITH OPEN MOUTH
😧 128551 1F627   ANGUISHED FACE
😨 128552 1F628   FEARFUL FACE
😩 128553 1F629   WEARY FACE
😪 128554 1F62A   SLEEPY FACE
😫 128555 1F62B   TIRED FACE
😬 128556 1F62C   GRIMACING FACE
😭 128557 1F62D   LOUDLY CRYING FACE
😮 128558 1F62E   FACE WITH OPEN MOUTH
😯 128559 1F62F   HUSHED FACE
😰 128560 1F630   FACE WITH OPEN MOUTH AND COLD SWEAT
😱 128561 1F631   FACE SCREAMING IN FEAR
😲 128562 1F632   ASTONISHED FACE
😳 128563 1F633   FLUSHED FACE
😴 128564 1F634   SLEEPING FACE
😵 128565 1F635   DIZZY FACE
😶 128566 1F636   FACE WITHOUT MOUTH
😷 128567 1F637   FACE WITH MEDICAL MASK
🙁 128577 1F641  
🙂 128578 1F642  
🙃 128579 1F643  
🙄 128580 1F644  
🤐 129296 1F910  
🤑 129297 1F911  
🤒 129298 1F912  
🤓 129299 1F913  
🤔 129300 1F914  
🤕 129301 1F915  
🤠 129312 1F920  
🤡 129313 1F921  
🤢 129314 1F922  
🤣 129315 1F923  
🤤 129316 1F924  
🤥 129317 1F925  
🤧 129319 1F927  
🤨 129320 1F928  
🤩 129321 1F929  
🤪 129322 1F92A  
🤫 129323 1F92B  
🤬 129324 1F92C  
🤭 129325 1F92D  
🤮 129326 1F92E  
🤯 129327 1F92F  
🧐 129488 1F9D0  


How do I get Emojis in HTML and CSS?

How to Create Emojis with CSS.
5 Step Guide to Create Dancing Eyes Emoji Only Using HTML, CSS, and JavaScript. ... .
Step 1 — Creating a new HTML file. ... .
Step 2 — Creating the Face of the Emoji. ... .
Step 3 — Creating the Mouth of the Emoji. ... .
Step 4 — Creating the Eyes of the Emoji..

What is the code for Emojis in HTML?

Emoji Characters Emojis are also characters from the UTF-8 alphabet: 😄 is 128516. 😍 is 128525. 💗 is 128151.

Can I use Emojis in my design?

So the emoji that appear on your iPhone or Android keyboard are used under that set of legal arrangements. This is why emoji may look different on different devices. You can use those emoji to say or communicate whatever you want. What you can't necessarily do, however, is reproduce those emoji on a product.

Chủ Đề