CSS3---永动的方块
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style>
@-webkit-keyframes domove{
0%{
left: 0;
top: 0;
}
25%{
left: 300px;
top: 0;
}
50%{
left: 300px;
top: 300px;
}
75%{
left: 0;
top: 300px;
}
100%{
left: 0;
top: 0;
}
}
.wrap{
width: 400px;
height: 400px;
border: 1px solid black;
position: relative;
}
.inner{
width: 100px;
height: 100px;
background: red;
position: absolute;
left: 0;
top: 0;
-webkit-animation: 2s domove infinite;
}
</style>
</head>
<body>
<div class="wrap">
<div class="inner">
</div>
</div>
</body>
</html>
效果图: