我的动画css不适用于firefox和IE

时间:2015-09-04 16:02:46

标签: css firefox css-animations

我找到了一个使用动画css的代码。它适用于chrome,但在firefox和IE中它坚持 这段代码用云创造了一片美好的天空。

我缩短了我的代码。

有人能帮助我吗?

.sky {
-webkit-animation:sky_background 50s ease-out infinite;
-moz-animation:sky_background 50s ease-out infinite;
-o-animation:sky_background 50s ease-out infinite;
-webkit-transform:translate3d(0,0,0);
-moz-transform:translate3d(0,0,0);
-o-transform:translate3d(0,0,0);
}
.clouds_one 
{
-webkit-animation:cloud_one 50s linear infinite;
-moz-animation:cloud_one 50s linear infinite;
-o-animation:cloud_one 50s linear infinite;
-webkit-transform:translate3d(0,0,0);
-moz-transform:translate3d(0,0,0);
-o-transform:translate3d(0,0,0)
}
@-webkit-keyframes cloud_one {
0% {left:0}
100% {left:-200%}
}
@-moz-keyframes cloud_one {
0% {left:0}
100% {left:-200%}
}

1 个答案:

答案 0 :(得分:0)

好的......你有一些CSS错误(缺少分号)这可能是原始问题缺少一些供应商前缀的声明,我认为,有些 - 前缀版本。

但是,为了完整起见,我在下面的Stack Snippet中给出了完整的CSS。

使用Codepen之后在Autoprefixer中编译,我强烈推荐使用。

在Chrome 45,FF41b& W10上的IE Edge。



.sky {
  height: 580px;
  background: #007fd5;
  position: relative;
  overflow: hidden;
  -webkit-animation: sky_background 50s ease-out infinite;
  -moz-animation: sky_background 50s ease-out infinite;
  -o-animation: sky_background 50s ease-out infinite;
  -webkit-transform: translate3d(0, 0, 0);
  -moz-transform: translate3d(0, 0, 0);
  -o-transform: translate3d(0, 0, 0);
  float: right;
  width: 100%;
  padding: 0px 0px;
  position: relative;
  right: 0px
}
.clouds_one {
  background: url('http://project.exceliran.com/ProjectForm/img/clouds/cloud_one.png');
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 300%;
  -webkit-animation: cloud_one 50s linear infinite;
  -moz-animation: cloud_one 50s linear infinite;
  -o-animation: cloud_one 50s linear infinite;
  -webkit-transform: translate3d(0, 0, 0);
  -moz-transform: translate3d(0, 0, 0);
  -o-transform: translate3d(0, 0, 0);
  -webkit-animation-name: bounce;
  animation-name: bounce;
  -webkit-animation-duration: 4s;
  animation-duration: 4s;
  -webkit-animation-iteration-count: 10;
  animation-iteration-count: 10;
  -webkit-animation-direction: alternate;
  animation-direction: alternate;
  -webkit-animation-timing-function: ease-out;
  animation-timing-function: ease-out;
  -webkit-animation-delay: 2s;
  animation-delay: 2s;
}
.clouds_two {
  background: url('http://project.exceliran.com/ProjectForm/img/clouds/cloud_two.png');
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 300%;
  -webkit-animation: cloud_two 75s linear infinite;
  -moz-animation: cloud_two 75s linear infinite;
  -o-animation: cloud_two 75s linear infinite;
  -webkit-transform: translate3d(0, 0, 0);
  -moz-transform: translate3d(0, 0, 0);
  -o-transform: translate3d(0, 0, 0)
}
.clouds_three {
  background: url('http://project.exceliran.com/ProjectForm/img/clouds/cloud_three.png');
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 300%;
  -webkit-animation: cloud_three 100s linear infinite;
  -moz-animation: cloud_three 100s linear infinite;
  -o-animation: cloud_three 100s linear infinite;
  -webkit-transform: translate3d(0, 0, 0);
  -moz-transform: translate3d(0, 0, 0);
  -o-transform: translate3d(0, 0, 0)
}
@-webkit-keyframes sky_background {
  0% {
    background: #007fd5;
    color: #007fd5
  }
  50% {
    background: #007fd5;
    color: #a3d9ff
  }
  100% {
    background: #007fd5;
    color: #007fd5
  }
}
@-webkit-keyframes moon {
  0% {
    opacity: 0;
    left: -200%;
    -moz-transform: scale(0.5);
    -webkit-transform: scale(0.5);
  }
  50% {
    opacity: 1;
    -moz-transform: scale(1);
    left: 0%;
    bottom: 250px;
    -webkit-transform: scale(1);
  }
  100% {
    opacity: 0;
    bottom: 500px;
    -moz-transform: scale(0.5);
    -webkit-transform: scale(0.5);
  }
}
@-webkit-keyframes cloud_one {
  0% {
    left: 0
  }
  100% {
    left: -200%
  }
}
@-webkit-keyframes cloud_two {
  0% {
    left: 0
  }
  100% {
    left: -200%
  }
}
@-webkit-keyframes cloud_three {
  0% {
    left: 0
  }
  100% {
    left: -200%
  }
}
#webdesign {
  float: right;
  width: 100%;
  box-sizing: border-box;
  padding: 20px;
}
@keyframes cloud_one {
  0% {
    left: 0
  }
  100% {
    left: -200%
  }
}
@keyframes cloud_two {
  0% {
    left: 0
  }
  100% {
    left: -200%
  }
}
@keyframes cloud_three {
  0% {
    left: 0
  }
  100% {
    left: -200%
  }
}

<div class="sky">
  <div class="moon"></div>
  <div class="clouds_one"></div>
  <div class="clouds_two"></div>
  <div class="clouds_three"></div>
</div>
&#13;
&#13;
&#13;