CSS动画设置
2014-05-15 14:39
260 查看
<!DOCTYPE html>
<html>
<head>
<style>
div
{
width:100px;
height:100px;
background:red;
position:relative;
animation:myfirst 5s;
//重点 持续动画的重点
-moz-animation:myfirst 5s; /* Firefox */
-moz-animation-iteration-count:infinite;
-webkit-animation:myfirst 5s; /* Safari and Chrome */
-o-animation:myfirst 5s; /* Opera */
}
@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;}
}
@-moz-keyframes myfirst /* Firefox */
{
0% {background:red; left:200px; top:0px;}
25% {background:yellow; left:200px; top:0px;}
50% {background:blue; left:200px; top:200px;}
75% {background:green; left:200px; top:200px;}
100% {background:red; left:200px; top:0px;}
}
@-webkit-keyframes myfirst /* Safari and Chrome */
{
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;}
}
@-o-keyframes myfirst /* Opera */
{
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;}
}
</style>
</head>
<body>
<p><b>注释:</b>本例在 Internet Explorer 中无效。</p>
<div>1111</div>
</body>
</html>
<html>
<head>
<style>
div
{
width:100px;
height:100px;
background:red;
position:relative;
animation:myfirst 5s;
//重点 持续动画的重点
-moz-animation:myfirst 5s; /* Firefox */
-moz-animation-iteration-count:infinite;
-webkit-animation:myfirst 5s; /* Safari and Chrome */
-o-animation:myfirst 5s; /* Opera */
}
@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;}
}
@-moz-keyframes myfirst /* Firefox */
{
0% {background:red; left:200px; top:0px;}
25% {background:yellow; left:200px; top:0px;}
50% {background:blue; left:200px; top:200px;}
75% {background:green; left:200px; top:200px;}
100% {background:red; left:200px; top:0px;}
}
@-webkit-keyframes myfirst /* Safari and Chrome */
{
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;}
}
@-o-keyframes myfirst /* Opera */
{
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;}
}
</style>
</head>
<body>
<p><b>注释:</b>本例在 Internet Explorer 中无效。</p>
<div>1111</div>
</body>
</html>
相关文章推荐
- css设置height 由0到auto的动画效果
- Jquery中在slideUp等动画后设置css()可能无效的原因
- AJAX--UpdateProgress设置CSS元素POSITION的使动画居中 & loading的Info
- css边框、背景设置、字体效果、2D、3D变化及css动画
- AJAX--UpdateProgress设置CSS元素POSITION的使动画居中 & loading的Info
- 常用UI CSS设置
- web打印字体css设置
- JS轻松实现CSS设置,DIV+CSS常用CSS设置
- 简单设置blog的样式CSS
- 希望博客园的CSS设置能取消字号限制
- CSS图片透明度设置及层定位
- DIV中滚动条设置到随机位置(CSS+Javascript)
- CSS设置网页的字体 防浏览器浏览页面字体变形
- css设置页面边距
- div+css使用backgroundRepeat样式设置背景图片的显示方式
- css滚动条颜色参数设置
- DIV中滚动条设置到随机位置(CSS+Javascript)
- HTML元素的默认CSS设置介绍
- 根据不同input类型设置不同的css
- CSS设置网页的字体 防浏览器浏览页面字体变形