Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/40.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Css 通过关键帧设置背景位置动画在Webkit上不起作用_Css_Google Chrome_Safari_Webkit_Css Animations - Fatal编程技术网

Css 通过关键帧设置背景位置动画在Webkit上不起作用

Css 通过关键帧设置背景位置动画在Webkit上不起作用,css,google-chrome,safari,webkit,css-animations,Css,Google Chrome,Safari,Webkit,Css Animations,我不明白为什么背景位置的动画不能在我版本的Chrome Safari(Webkit浏览器)上工作。它在Firefox上运行良好 @keyframes animatedBackground { from { background-position: 0px 0px; } to { background-position: 100% 0px; } } .logo { width: 600px; height: 300px; background-image:

我不明白为什么背景位置的动画不能在我版本的Chrome Safari(Webkit浏览器)上工作。它在Firefox上运行良好

@keyframes animatedBackground {
  from {
    background-position: 0px 0px; }

  to {
    background-position: 100% 0px; } 
}

.logo {
  width: 600px;
  height: 300px;
  background-image: url("http://placekitten.com/g/200/300");
  background-position: 0px 0px;

  -webkit-animation: animatedBackground 10s linear infinite;
  -moz-animation: animatedBackground 10s linear infinite;
  animation: animatedBackground 10s linear infinite; 
}

非常感谢任何帮助


LM.

您还需要在
@keyframes
前面加上浏览器特定的前缀“-webkit”,请参阅

尝试将此添加到CSS中:

@-webkit-keyframes animatedBackground {
  from {
    background-position: 0px 0px; }

  to {
    background-position: 100% 0px; } 
}
固定小提琴: