docs.rodeo

MDN Web Docs mirror

font-variant-emoji

{{CSSRef}} 

The font-variant-emoji CSS property specifies the default presentation style for displaying emojis.

Traditionally, this was done by appending a Variation Selector, U+FE0E for text and U+FE0F for emoji, to the emoji code point. Only emojis listed as contributing to a Unicode emoji presentation sequence are affected by this property.

Syntax

/* Keyword values */
font-variant-emoji: normal;
font-variant-emoji: text;
font-variant-emoji: emoji;
font-variant-emoji: unicode;

/* Global values */
font-variant-emoji: inherit;
font-variant-emoji: initial;
font-variant-emoji: revert;
font-variant-emoji: revert-layer;
font-variant-emoji: unset;

The font-variant-emoji property is specified using a single keyword value from the list below.

Values

Formal definition

{{CSSInfo}} 

Formal syntax

{{CSSSyntax}} 

Accessibility

While the use of emojis may seem fun, you should consider their impact on accessibility, specifically for users with visual and cognitive impairments. Consider the following factors while using emojis:

Examples

Changing the way an emoji is displayed

This example shows how you can render an emoji in its text or emoji presentation.

HTML

<p class="no-support">
  Your Browser does not support <code>font-variant-emoji</code>. This image
  shows how it is rendered with support.
</p>
<img
  class="no-support"
  src="./font-variant-emoji-example.jpg"
  alt="a telephone emoji show as text, black and white next to a telephone emoji shown as emoji full color and graphical representation" />
<section class="emojis">
  <div class="emoji">
    <h2>text presentation</h2>
    <div class="text-presentation"></div>
  </div>
  <div class="emoji">
    <h2>emoji presentation</h2>
    <div class="emoji-presentation"></div>
  </div>
</section>

CSS

@supports (font-variant-emoji: emoji) {
  .no-support {
    display: none;
  }
  .emojis {
    display: flex;
    flex-direction: row;
    justify-content: space-around;
  }
  .emoji > div {
    font-size: 2rem;
  }
}

@supports not (font-variant-emoji: emoji) {
  .emojis {
    display: none;
  }
}
.text-presentation {
  font-variant-emoji: text;
}

.emoji-presentation {
  font-variant-emoji: emoji;
}

Result

{{ EmbedLiveSample('Changing the way an emoji is displayed') }} 

Specifications

{{Specifications}} 

Browser compatibility

{{Compat}} 

See also

In this article

View on MDN