I would like to have a text that switches its color at a certain point x. I have provided a sample that uses the text twice to produce the result, with the switch at 45px. I
Got it! Mixed a few things from the answers together to get this:
div{
border: 1px solid #000;
position: relative;
display: inline-block;
}
div>span{
color: rgba(0, 0, 0, 0);
z-index: 3;
}
div:before, div:after{
content: attr(data-content);
position: absolute;
top: 0;
left: 0;
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
div:before{
color: blue;
clip: rect(0 200px 40px 45px);
z-index: 1;
}
div:after{
color: red;
clip: rect(0 45px 40px 0);
z-index: 2;
}
Some bicolored Text
Upvoted all the answers for partial solutions.