Strange behaviour: gradient and rotation
Hello !
I am looking for a way to apply a gradient to a set of elements that are tilted
I have managed to create a progressive gradient on the icons (and not applied to each of them), but when a transformation is applied, the gradient disappears
Here is a Codepen to better understand what I want to achieve. I would like the gradient to be applied to the icons and not to the background
https://codepen.io/perr0112/pen/azdKjVY
17 Replies
background-clip: text; still feels like magic sometimesis it just me, or can i not see the icons?
yes it's a bit tricky tho
the preview doesn't show them for some reason, but if you click through it should work
you can see something on your side?

huh, they show up in firefox, but not in edge or chrome

that's a first lol
thats why
do you know which property is not well supported then?
at least it works somewhere
I'm not confident enough to say for sure, but this feels like a bug
any transform breaks the text clip, even a translate or scale
oh yea
i have never understood how and why some properties are handled differently depending on the browser
it makes no sense to me
There's apparently several issues: https://issues.chromium.org/issues/41385122 https://issues.chromium.org/issues/40858028
because it's very easy to underestimate how complex CSS engines are. They are wickedly complicated and while the spec often describes perfectly how a property should behave in isolation, interactions with other properties can be somewhat undefined. They can also be harder to implement in one engine vs the other because of previous choices, or have performance impacts that necessitate other choices
on top of that, you're also working with different companies producing a product that has its own agenda, which can also weigh into decisions
i see, so some properties are managed completely arbitrarily, at least they do not follow any formal rules?
oh thanks a lot, i'll dig into it
not completely arbitrarily, but even if you have solid requirements some of the edge cases in the implementation details are going to be based on the best-effort guess from the development team
and the more complex the requirements and the system they live in, the more those assumptions will be different between two similar projects
oh wow ok, i understand better now, thank you very much
i admit that at first glance, ididn't think at all that they were not perfectly aligned and that this kind of problem might arise
i still haven't figured out how to solve this, so it's very frustrating
you could maybe replace the text with an SVG that's already rotated the right way
though you'd probably already need the background on there properly
i think that i will play with opacity depending on the position of the icon inside the container
because i don't need any color, gray is enough to play with in my case
Oh weird, apologies discord didn’t load any comments while I was writing this; didn’t realize there were already replies!!
Could the prefixed
-webkit -background-clip prop help so it’s showing up in edge or Firefox ? I remember safari beibg very finicky about the order that properties are declared for some of the bg properties.