效果图:
animate.gif
代码:
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>css动画</title>
<style>
*{
margin:0;
padding:0;
}
.wrap{
position: relative;
width:300px;
margin:150px auto;
overflow: hidden;
height:50px;
line-height:50px;
background: #cccccc;
transform: skewX(10deg) skewY(-10deg);
}
.animate-wap{
height: 100%;
width: 200%;
position: absolute;
right: 0;
top: 0;
animation: 5s move infinite linear;
}
.box{
height: 100%;
float: left;
width:50%;
text-align: center;
position: relative;
}
.box >span{
display: block;
width:20%;
text-align: center;
background: #FF8025;
}
@keyframes move {
0% {
right: 0;
}
100% {
right: -100%;
}
}
</style>
</head>
<body>
<div class="wrap">
<div class="animate-wap">
<div class="box"> <span>box</span> </div>
<div class="box"> <span>box</span> </div>
</div>
</div>
</body>
</html>
···
网友评论