本文主要介绍了flex布局实现无缝滚动的示例代码,分享给大家,具体如下:
案例的演示

flex布局
所谓flex布局就是弹性盒布局,这种布局在移动端比较常用,但随着浏览器的版本更新,flex布局因为自身的优点,日渐常用。
思路:
动画效果
css部分代码
* {
margin: 0;
padding: 0;
}
a {
text-decoration: none;
}
.box-big {
position: absolute;
display: flex;
left: 50%;
top: 50%;
border: 1px solid #9FD6FF;
transform: translate(-50%, -50%);
width: 707px;
height: 170px;
/* background-color: pink; */
flex-wrap: wrap;
overflow: hidden;
}
.box-top {
width: 707px;
height: 30px;
border-bottom: 1px solid #9FD6FF;
background-color: #FEFEFE;
}
.div-bottom {
width: 707px;
height: 136px;
/* background-color: darkgoldenrod; */
overflow: hidden;
}
.st-icon-android {
display: inline-block;
width: 15px;
height: 15px;
background-image: url(../img/hd.gif);
margin: 8px;
}
h5 {
position: absolute;
top: 6PX;
left: 30px;
color: #307DD1;
}
ul {
position: absolute;
left: 90px;
width: 3000px;
height: 100%;
animation: run 20s linear infinite;
}
li {
list-style: none;
float: left;
width: 140px;
height: 100%;
margin: 0 5px 0 5px;
/* background-color: gold; */
flex-wrap: wrap;
}
.photo {
margin-top: 5px;
width: 140px;
height: 105px;
text-align: center;
/* background-color: springgreen; */
}
p {
text-align: center;
}
img {
cursor: pointer;
}
@keyframes run {
0% {
left: 0;
}
100% {
left: -745px;
}
}
到此这篇关于flex布局实现无缝滚动的示例代码的文章就介绍到这了,更多相关flex无缝滚动内容请搜索脚本之家以前的文章或继续浏览下面的相关文章,希望大家以后多多支持脚本之家!