linear gradient + background-size is not working in firefox

老子叫甜甜 提交于 2019-12-13 02:38:34

问题


Im using a linear gradient with a background-size of 400%. this allows me to animate between gradients on hover and active state by changing the background-position. It works great in webkit but not in firefox. It seems as though the background-size property is not acknowledged at all.

Firefox is basically just squeezing the whole gradient in the element as if background-size is set to 100%.

Ive got a super simple page that demonstrates the problem:

http://firefoxgradient.s.cboo.st

(switch b/w firefox and webkit to see the difference)

Im using all the proper vendor prefixes for gradients and background-size.

I tinkered around with background-size on an image and it behaved as expected. Might be a gradient specific issue.


回答1:


The problem is, that in firefox background-size has two values one for the width and one of the height. If you do it like this: background-size: 400% firefox translates it to background-size: 400% auto. The auto is the value for the height. To fix it just write: -moz-background-size: 400% 400% this works for me.



来源:https://stackoverflow.com/questions/13523559/linear-gradient-background-size-is-not-working-in-firefox

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!