我是html5和css3的新手,我只是在玩不同的css3动画功能。谁能在下面的代码中指出错误?从左0像素到左200像素的移动不起作用。
<!doctype html>
<html>
<head>
<title>
Experiment: animation with movements
</title>
<style>
footer{
width: 100px;
height: 100px;
background: red;
animation: mymove 5s;
animation-play-state: running;
}
@-moz-keyframes mymove {
from {left:50px;}
to {left:200px;}
}
@keyframes mymove {
from {left:50px;}
to {left:200px;}
}
</style>
</head>
<body>
<footer>
</footer>
</body>
</html>
答案 0 :(得分:0)
将position: relative;
添加到footer
CSS
footer {
position: relative;
width: 100px;
height: 100px;
background: red;
animation: mymove 5s;
animation-play-state: running;
}
@-moz-keyframes mymove {
from {
left: 50px;
}
to {
left: 200px;
}
}
@keyframes mymove {
from {
left: 50px;
}
to {
left: 200px;
}
}
<footer></footer>