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;
}
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt talo.
Lorem😀ipsum🏑dolor🦁sit💝amet,💜consectetur🚲adipisicing🇧🇹elit,👒sed👙do💩eiusmod🔗tempor➿incididunt.🚧talo.