Remarkably, this issue still exists in Safari, and I found this question while trying to figure out a workaround. It seems to be a rounding error in the sizing of the clipped area vs the background being clipped, that results from transforms.
In my circumstances, it's being exposed at certain scaling or browser zoom levels (eg: pinch-zooming on iOS Safari), in a region with a scale transform being applied.
The various other tricks here helped make the issue less prominent, and I got to a point where it was almost gone with:
.gradient-text {
background: linear-gradient(227.67deg, #0288fb, #25c0fb, #37fffb, #9b62ef);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
/* Each of the below seemed to improve matters */
background-origin: content-box;
background-repeat: no-repeat;
transform: translateZ(0);
}
But at some infrequent zoom/scale levels, it'd still sneak back.
What seems to have finally killed it is adding a transparent 1px border to cover the sub-pixel rounding error. With that, the translateZ
and background-origin
didn't seem to make a difference if I removed them, but the background-repeat
is necessary to prevent the background just from extending to the edge of the border.
So I wound up with:
.gradient-text {
background: linear-gradient(227.67deg, #0288fb, #25c0fb, #37fffb, #9b62ef);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
border: 1px solid transparent;
background-repeat: no-repeat;
margin: -1px;
}
The negative margin is there because outlines didn't work and I didn't want this text to be nudged 1px out of alignment with other text in a column.