Terence Eden. He has a beard and is smiling.
Theme Switcher:

-webkit-text-stroke and emoji

· 6 comments · 250 words · Viewed ~526 times


The CSS property -webkit-text-stroke is a curious beastie.

MDN gives a big scary warning saying "Non-standard: This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web."

And yet, it works everywhere. All modern browsers support it. Except on Emoji.

Here's how it work. -webkit-text-stroke: pink 1px; draws a pink outline around text.

This has a pink outline!

Nifty! But what happens if you apply to emoji?

Smile 😁, Star ⭐, Melon 🍈

Nothing.

Interestingly any emoji with default text presentation - or using Variation Selector 15 - does get an outline ☺☮⭐︎

Why would this be useful

Here's an emoji which has the same roughly the colour as the background. Can you see it clearly? What if you select the text?

 ❤️ 

Having an outline would make it a lot easier to see.

So, what's so special about emoji? I guess that the way browsers render emoji is more similar to images rather than text? For example, their colours don't invert when selected.

Does anyone know a way to make this work? Or whether -webkit-text-stroke will ever be standardised?


Share this post on…

6 thoughts on “-webkit-text-stroke and emoji”

  1. Emoji are embedded into fonts as bitmaps, except for Windows, which uses vectors (including a black outline). So yeah, would never work…

    Reply

    1. I also get the outline as shown in the previous screenshot when using Edge.

      Reply

What are your reckons?

All comments are moderated and may not be published immediately. Your email address will not be published.

See allowed HTML elements: <a href="" title="">
<abbr title="">
<acronym title="">
<b>
<blockquote cite="">
<br>
<cite>
<code>
<del datetime="">
<em>
<i>
<img src="" alt="" title="" srcset="">
<p>
<pre>
<q cite="">
<s>
<strike>
<strong>

To respond on your own website, write a post which contains a link to this post - then enter the URl of your page here. Learn more about WebMentions.