【轮播图静态实现】

  • [github](https://github.com/mango2630/css_style/tree/master/%E8%BD%AE%E6%92%AD%E5%9B%BE)
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{
            margin: 0;
            padding: 0;
        }
        .box{
            width: 640px;
            height: 452px;
            border: 5px solid bisque;
            margin: 100px auto;
            position: relative;
        }
        .box > .main > img {
            /* 脱离文档流,显示的为最后一张 */
            position: absolute;
            left: 0;
            right: 0;
            display: none;
        }
        .box .main img.current{
            /* 让第一张图显示 */
            display: block;
        }

        /* 按钮 */
        .box .btns div{
            position: absolute;
            color: white;
            font-size: 40px;
            top: 50%;

            width: 60px;
            height: 40px;
            background-color: rgb(80, 85, 85);
            line-height: 40px;
            text-align: center;
            
            margin-top: -20px;
        }
        .last{
            left: 0;
        }
        .next{
            right: 0;
        }

        /* 小圆点 */
        ol{
            list-style: none;
        }
        .circle{
            width: 250px;
            height: 20px;
            background-color: rgba(80, 85, 85, 0.37);
            position: absolute;
            bottom: 10px;
            left: 50%;
            margin-left: -125px;
        }
        .circle ol li{
            width: 20px;
            height: 20px;
            float: left;
            margin: 0 10px;
            line-height: 20px;
            background-color: rgba(255, 255, 255, 0.74);
            border-radius: 50px;
            text-align: center;
            cursor: pointer;
        }
        .circle ol li.current{
            background-color: rgba(255, 217, 0, 0.466);
        }
    </style>
</head>
<body>
    <!-- 轮播图主体 -->
    <div class="box">
        <div class="main">
            <!-- 640 * 452 -->
            <img class="current" src="./images/0.png" alt="">
            <img src="./images/1.png" alt="">
            <img src="./images/2.png" alt="">
            <img src="./images/3.png" alt="">
            <img src="./images/4.png" alt="">
            <img src="./images/5.jpg" alt="">
        </div>

        <!-- 按钮 -->
        <div class="btns">
            <div class="last"><</div>
            <div class="next">></div>
        </div>

        <!-- 小圆点 -->
        <div class="circle">
            <ol>
                <li class="current">1</li>
                <li>2</li>
                <li>3</li>
                <li>4</li>
                <li>5</li>
                <li>6</li>
            </ol>
        </div>
    </div>
    <script src="./index.js"></script>
</body>
</html>
  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值