我试图让我的div在CSS3中上下移动,但它没有
<div class="globo"></div>
@-webkit-keyframes mover {
0%, 100% { top: 0%;}
50% { top: 5%; }
}
@-moz-keyframes mover {
0%, 100% { top: 0%;}
50% { top: 5%; }
}
@-o-keyframes mover {
0%, 100% { top: 0%;}
50% { top: 5%; }
}
@keyframes mover {
0%, 100% { top: 0%;}
50% { top: 5%; }
}
.globo{
float: left;
height: 300px;
width: 270px;
background: url('https://lh3.ggpht.com/-hCYXxhc-U4BqD1CBVCARXlp1bPT7ci7pP1Q4NEOzIKpS8zKPfyCCQF5xjEVUf4vGrJ2=w300');
-webkit-animation: mover 5s infinite; /* Safari 4+ */
-moz-animation: mover 5s infinite; /* Fx 5+ */
-o-animation: mover 5s infinite; /* Opera 12+ */
animation: mover 5s infinite;
}
您可以在此处查看我的代码:http://jsfiddle.net/LGMv7/1/
答案 0 :(得分:1)
添加到.globo
position: absolute;
.globo{
float:left;
position: absolute;
height: 300px;
width: 270px;
background: url('https://lh3.ggpht.com/-hCYXxhc-U4BqD1CBVCARXlp1bPT7ci7pP1Q4NEOzIKpS8zKPfyCCQF5xjEVUf4vGrJ2=w300');
-webkit-animation: mover 5s infinite; /* Safari 4+ */
-moz-animation: mover 5s infinite; /* Fx 5+ */
-o-animation: mover 5s infinite; /* Opera 12+ */
animation: mover 5s infinite;
}
<强> demo 强>
答案 1 :(得分:0)
你的div需要!绝对的位置!试试吧!
或应用属性转换,whit转换你div.globo不需要位置绝对!