Is it possible in css make a single character in 2 colors?
I mean for example character "B" The first upper half in RED and the second half in BLUE
h1 {
font-size: 72px;
background: -webkit-linear-gradient(red 49%, blue 50%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
Fill in your own vendor prefixes.
One solution would be:
HTML:
<span class="half" title="B">B</span>
(see that you have to set an attribute value)
CSS:
.half {
font-size: 90px;
font-weight: bold;
position: relative;
color: blue;
line-height: 1em;
}
.half:before {
position:absolute;
content:''attr(title)'';
color: red;
height: .5em;
overflow: hidden;
}
The problem is that every browser calculates the .5em value differently
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