Fixing Emoji in Chrome

Helping Chrome Display Emoji Inside font-weight: bold

In Chrome you can use emoji inside HTML and it will usually work, unless it's displayed as bold text. Instead of always checking to make sure that your emoji never show up inside of anything that has font-weight: bold; applied to it you can use an emoji-embedding solution like this to avoid the problem entirely.

If you add a data-emoji attribute to a tag, and set either one single emoji or a string of text containing emoji as the value of that attribute, we can ensure that element always uses font-weight: normal and then output the content from our custom data-emoji attribute as :before content.

Format your HTML like this to insert a smiling emoji

<i data-emoji="😀"></i>

And then make sure the following styles are present somewhere in your CSS:

[data-emoji] {
  font-style: normal;
  font-weight: normal;
}
[data-emoji]:before {
  content: attr(data-emoji);
  margin-right: .125em;
}

With the fix (works in Chrome)

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt talo.

Without the fix (broken in Chrome)

Lorem😀ipsum🏑dolor🦁sit💝amet,💜consectetur🚲adipisicing🇧🇹elit,👒sed👙do💩eiusmod🔗tempor➿incididunt.🚧talo.