css代码
@keyframes scroll {
0% {
background-position: 0 0;
}
100% {
background-position:-1020px 0; //图片的宽度
}
}
.bgImg{
/* width:270%; */
height:100%;
background:url(../images/bgimg.png) repeat-x;
background-position: left center;
animation: scroll 30s linear infinite;
}
html代码
<body>
<div class="bgImg"></div>
</body>
图片最好是左右能衔接上的。
转载
https://blog.csdn.net/huayuaer/article/details/101539423