Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Heavy Plus Sign" ➕ in CSS ::before?

Tags:

html

text

css

emoji

I am trying to get the code for the "Heavy Plus Sign" emoji (➕) working in a CSS ::before pseudo-element. The Unicode number for it is U+2795. My [non-working] code is as follows:

.plussign::before {
    content: "\12795";
}

When I assign an element to use class="plussign", all I see is a little black square (the generic unknown character)

What should I use for the "content" property? The slash-one (\1) method works for all my other emojis. For example, this works for the gemstone (💎, Unicode U+1F48E):

.gem::before {
    content: "\1F48E";
}

Why doesn't the "Heavy Plus Sign" emoji work in the same format?

like image 904
user3163495 Avatar asked Sep 15 '25 12:09

user3163495


1 Answers

You're looking for \2795 (no leading 1, the codepoint is U+2795, not U+12795):

.plussign::before {
  content: "\2795";
}
<div class="plussign"></div>

Or of course, the character itself:

.plussign::before {
  content: "➕";
}
<div class="plussign"></div>
like image 136
T.J. Crowder Avatar answered Sep 18 '25 12:09

T.J. Crowder