0
点赞
收藏
分享

微信扫一扫

学习笔记三

闲嫌咸贤 2022-01-31 阅读 48
csshtmlcss3

用html+css实现轮播图

html部分:

    <div class="slide">
        <ul class="lunbo">
            <li>1</li>
            <li>2</li>
            <li>3</li>
        </ul>
    </div>

css部分

.slide{
    position: relative;
    margin: auto;
    width: 400px;
    height: 400px;
    text-align: center;
    overflow: hidden;
}
ul{
    margin: 10px 0;
    padding: 0;
    width: 10000px;
    transition: all 0.5s;
}
.slide .lunbo{
    animation: marginleft 10.5s infinite;
}
.slide li{
    float: left;
    width: 400px;
    height: 400px;
    list-style: none;
    line-height: 200px;
}
.slide li:nth-child(1){
    background-color: black;
}
.slide li:nth-child(2){
    background-color: burlywood;
}
.slide li:nth-child(3){
    background-color: coral;
}
@keyframes marginleft {
    0%{
        margin-left: 0;
    }
    33%{
        margin-left: -400px;
    }
    66%{
        margin-left: -800px;
    }
    95%{
        margin-left: -1200px;
    }
    100%{
        margin-left: 0;
    }
}

但是基本可以实现,效果还有点瑕疵

 

 

举报

相关推荐

Java学习笔记(三)

MongoDB学习笔记(三)

HTML学习笔记(三)

kafka学习笔记三

FFmpeg学习笔记(三)

【Mysql学习笔记(三)】

STL学习笔记(三)

0 条评论