欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

CSS3 动画

程序员文章站 2022-03-16 18:05:10
...

需求:背景色变换

html:

<div class="refreshAuto"></div>

css:

.refreshAuto{
  width :100px;
  height:100px;
  animation:myfirst 3s linear 0s infinite alternate;
  /* Firefox: */
  -moz-animation:myfirst 3s linear 0s infinite alternate;
  /* Safari and Chrome: */
  -webkit-animation:myfirst 3s linear 0s infinite alternate;
  /* Opera: */
  -o-animation:myfirst 3s linear 0s infinite alternate;
}
@keyframes myfirst
{
0%   {background:#3b547f;}
100% {background:#409EFF;}
}

@-moz-keyframes myfirst /* Firefox */
{
0%   {background:#3b547f;}
100% {background:#409EFF;}
}

@-webkit-keyframes myfirst /* Safari and Chrome */
{
0%   {background:#3b547f;}
100% {background:#409EFF;}
}

@-o-keyframes myfirst /* Opera */
{
0%   {background:#3b547f;}
100% {background:#409EFF;}
}

参考文献:CSS3 动画