Reputation: 2216
Any idea on how to change text color for 2 parts of gradient line? For example here if I want the blue part of the text ('s', 'o' and a part of 'm') to be black?
.button{
background: linear-gradient(140deg, #00C9FF 35%, transparent 35%);
}
Upvotes: 8
Views: 1809
Reputation: 13199
You can do it wrapping the text in a <p>
tag and setting a linear-gradient
to this tag.
button{
background: linear-gradient(140deg, #00C9FF 35%, transparent 35%);
color: white;
font-size: 30px;
}
p{
margin: 0;
font-size: 50px;
background: -webkit-linear-gradient(130deg, red 65%, black 15%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
<button type="button"><p>some long text</p></button>
Upvotes: 2