css动画

为君一笑 提交于 2019-11-28 14:46:17

css的动画效果在style标签中用@keyframes name{。。。}的形式定义,使用animation:name time 。。。的形式进行调用。

示例:

<style>

@keyframes myfirst
{
0%   {background: red; left:0px; top:0px;}
25%  {background: yellow; left:200px; top:0px;}
50%  {background: blue; left:200px; top:200px;}
75%  {background: green; left:0px; top:200px;}
100% {background: red; left:0px; top:0px;}
}

div
{
width:100px;
height:100px;
background:red;
position:relative;
animation:myfirst 5s;
}

</style>

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