Skip to content

Instantly share code, notes, and snippets.

@Armster15
Last active September 3, 2023 05:15
Show Gist options
  • Save Armster15/db063ab0dc5be699ae07a067a7333752 to your computer and use it in GitHub Desktop.
Save Armster15/db063ab0dc5be699ae07a067a7333752 to your computer and use it in GitHub Desktop.
A simple HTML example on how to use Twemojis in your website!
<!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>
@danielsebesta
Copy link

thanks

@sheladiyaniraj
Copy link

Thanks 💖💖

@jaikt
Copy link

jaikt commented May 19, 2022

more love :P thanks!

@NoahTheNerd
Copy link

hey, the emojis are a bit up from the paragraph, any fix?

@Euro-pol
Copy link

thanks bro

@danielsebesta
Copy link

hey, the emojis are a bit up from the paragraph, any fix?

@NoahTheNerd you can check my gist about Twemojis, I tweaked it.

@alipyth
Copy link

alipyth commented Jul 13, 2023

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