淘宝轮播图——nav中小圆点li的做法

<!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>轮播图</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }
        
        .box {
            position: relative;
            width: 520px;
            height: 280px;
            margin: 100px auto;
        }
        
        .box img {
            width: 100%;
            height: 100%;
        }
        
        .box a {
            position: absolute;
            top: 50%;
            margin-top: -15px;
            width: 20px;
            height: 30px;
            background-color: rgba(0, 0, 0, .7);
            color: #fff;
            /* 下面两个忘了 */
            text-align: center;
            line-height: 30px;
            text-decoration: none;
        }
        
        .box .prev {
            left: 0;
            border-radius: 0 15px 15px 0;
        }
        
        .box .next {
            right: 0;
            border-radius: 15px 0 0 15px;
        }
        
        .box ul {
            position: absolute;
            bottom: 10px;
            left: 50%;
            margin-left: -35px;
            width: 70px;
            height: 13px;
            border-radius: 6px;
            background-color: rgba(255, 255, 255, .3);
        }
        
        li {
            list-style: none;
            float: left;
            width: 8px;
            height: 8px;
            border-radius: 50%;
            background-color: white;
            margin-left: 4px;
            margin-top: 2px;
        }
        
        .nav .selected {
            background-color: orange;
        }
    </style>
</head>

<body>
    <div class="box">
        <img src="tb.jpg" alt="">
        <a href="#" class="prev">&lt;</a>
        <a href="#" class="next">&gt;</a>
        <ul class="nav">
            <li class="selected"></li>
            <li></li>
            <li></li>
            <li></li>
            <li></li>
        </ul>


    </div>
</body>

</html>

posted @ 2021-03-26 12:46  ice猫猫3  阅读(141)  评论(0编辑  收藏  举报