Last active
January 31, 2025 14:58
-
-
Save Armster15/db063ab0dc5be699ae07a067a7333752 to your computer and use it in GitHub Desktop.
A simple HTML example on how to use Twemojis in your website!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Twemoji Tutorial</title> | |
<!-- This retrieves the latest Twemoji script --> | |
<script src="https://twemoji.maxcdn.com/v/latest/twemoji.min.js" crossorigin="anonymous"></script> | |
<!-- Script to render emojis as Twemojis --> | |
<script> | |
window.onload = function() { | |
// Parses the document body and | |
// inserts <img> tags in place of Unicode Emojis | |
twemoji.parse(document.body, | |
{folder: 'svg', ext: '.svg'} // This is to specify to Twemoji to use SVGs and not PNGs | |
); | |
} | |
</script> | |
<!-- CSS configurations to tweak how the Twemojis are displayed --> | |
<style> | |
img.emoji { | |
/* Since we are using SVGs, you have to change the width using CSS */ | |
width:1.5em; | |
/* | |
This is to make the emojis feel like actual emojis to | |
the user and they won't act like images. This makes the emojis | |
non-reactive to any mouse events such as dragging, | |
hovering, clicking etc. Makes it feel like its actual text. | |
*/ | |
pointer-events: none; | |
} | |
</style> | |
</head> | |
<body> | |
<h1> Welcome to Bunni Land! 🐰🐇</h1> | |
</body> | |
</html> |
Thanks 💖💖
more love :P thanks!
hey, the emojis are a bit up from the paragraph, any fix?
thanks bro
hey, the emojis are a bit up from the paragraph, any fix?
@NoahTheNerd you can check my gist about Twemojis, I tweaked it.
hello , i using streamlit selectbox , when i try to change option in select box its cannot image flag ! can you tell me what is this problem ?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
thanks