<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>变形与动画</title> <style type="text/css"> @-webkit-keyframes move { 0%{ transform: translate(0); } 15%{ transform: translate(100px,180px); } 30%{ transform: translate(150px,0); } 45%{ transform: translate(250px,180px); } 60%{ transform:translate(300px,0); } 75%{ transform: translate(450px,180px); } 100%{ transform: translate(480px,0); } } div { width: 500px; height: 200px; border: 1px solid red; margin: 20px auto; } div span { display: inline-block; width: 20px; height: 20px; background: green; border-radius: 100%; -webkit-animation-name:move; -webkit-animation-duration: 10s; -webkit-animation-timing-function:ease; -webkit-animation-delay:.1s; -webkit-animation-iteration-count:infinite; } </style> </head> <body> <div><span></span></div> </body> </html>
在我的浏览器里运行是没有问题的
@-webkit-keyframes move{}里面的transform前也要加-webkit-,我的可以,你再试一下
@-webkit-keyframes move {
0%{
-webkit-transform: translate(0);
}
15%{
-webkit-transform: translate(100px,180px);
}
30%{
-webkit-transform: translate(150px,0);
}
45%{
-webkit-transform: translate(250px,180px);
}
60%{
-webkit-transform:translate(300px,0);
}
75%{
-webkit-transform: translate(450px,180px);
}
100%{
-webkit-transfrom: translate(480px,0);
}
}
div {
width: 500px;
height: 200px;
border: 1px solid red;
margin: 20px auto;
}
div span {
display: inline-block;
width: 20px;
height: 20px;
background: green;
border-radius: 100%;
-webkit-animation-name:move;
-webkit-animation-duration: 10s;
-webkit-animation-timing-function:ease;
-webkit-animation-delay:.1s;
-webkit-animation-iteration-count:infinite;
}