I would like to style the unicode character DROPLET (💧), specifically change the blue color to something else.
.red {
color: red;
background-color: yellow;
}
<span class="red">DROPLET 💧</span>
The yellow
style is applied but not the color of the character (the text is correctly styled).
Is styling any unicode glyph possible?
To do this, just type the hexadecimal code of the character into a Word document and then press ALT + C (in dialog boxes ALT + X). Then automatically the required Unicode character appears. The same shortcut can also be used to display the code of the character that comes before the cursur.
Each Unicode character has its own number and HTML-code. Example: Cyrillic capital letter Э has number U+042D (042D – it is hexadecimal number), code ъ. In a table, letter Э located at intersection line no. 0420 and column D. If you want to know number of some symbol, you may found it in a table.
So unless there is a character commonly used in texts to symbolize cut and paste, you shouldn’t expect to find such a symbol in Unicode. U+2702 BLACK SCISSORS is in Unicode since it appears in older character codes, and it has been used in printed documents to indicate a cutting line, as a “cut here” indicator, rather than as a symbol of copying.
Unicode symbols. Each Unicode character has its own number and HTML-code. Example: Cyrillic capital letter Э has number U+042D (042D – it is hexadecimal number), code ъ. In a table, letter Э located at intersection line no. 0420 and column D. If you want to know number of some Unicode symbol, you may found it in a table.
You can try with filter
.red {
color: red;
background-color: yellow;
}
.red > span {
filter: hue-rotate(180deg) saturate(10);
}
<span class="red">DROPLET <span>💧</span></span>
Or mix-blend-mode but this will also affect the background:
.red {
background:#fff;
position:relative;
display:inline-block;
}
.red > span {
filter:brightness(0); /* We make the icon black */
}
.red:before {
content:"";
position:absolute;
top:0;
left:0;
right:0;
bottom:0;
background:red;
pointer-events:none;
mix-blend-mode:lighten; /* this will make the icon red since red is more "light" than black*/
z-index: 1;
}
<span class="red">DROPLET <span>💧</span></span>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With