【发布时间】:2015-06-05 11:48:02
【问题描述】:
这是我正在使用的 CSS 代码:
img {
position: relative;
-webkit-animation: movingImage infinite linear 2s infinite;
animation: movingImage infinite linear 2s infinite;
}
@-webkit-keyframes movingImage {
0% {left: 0px; top: 0px;}
25% {left: 200px; top: 0px;}
50% {left: 200px; top: 200px;}
75% {left: 0px; top: 200px;}
100% {left: 0px; top: 0px;}
}
@keyframes movingImage {
0% {left: 0px; top: 0px;}
25% {left: 200px; top: 0px;}
50% {left: 200px; top: 200px;}
75% {left: 0px; top: 200px;}
100% {left: 0px; top: 0px;}
}
还有我拥有的 HTML:
<img src="image.png" width="50" height="50" alt="Image">
【问题讨论】:
-
尝试将动画规则改为
movingImage 2s infinite linear; -
谢谢,成功了!你介意解释一下发生了什么变化吗,我知道它与它可以采用的所有不同值有关,但我没有得到我必须使用它们的顺序。