css3轮播图案例

轮播图案例

html 复制代码
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        li {
            list-style: none;
        }
        .banner {
            margin: 100px auto;
            width: 554px;
            height: 315px;
            /* background-color: pink; */
            overflow: hidden;
            position:relative;     
        }
        .banner img {
            width: 564px;
            height: 315px;
            border-radius: 5%;
            vertical-align: middle;
        }
        .banner ul {
            display: flex;
        }
        .banner .zuo,
        .banner .you {
            /* 因为我们想让两边的标签
            只有鼠标悬停的时候才出现
            所以这里我们先将两个标签的显示属性设置为none*/
            display: none;
            position: absolute;
            width: 20px;
            height: 30px;
            top: 50%;
            transform: translateY();
            background-color: rgba(0,0,0,0.3);
            text-decoration: none;
            color: white;
            line-height: 30px;
        }
        .banner .zuo{
            left: 0;
            border-radius: 0 15px 15px 0;
        }
        .banner .you{
            right: 0;
            border-radius:15px 0 0 15 px;
            text-align: center;
        }
        .banner:hover .zuo, .banner:hover .you {
            /* 这边设置的是鼠标悬停时标签才会出现 */
            display: block;
        }
        .banner ol {
            position: absolute;
            bottom: 20px;
            left: 50%;
            transform: translateX(-50%);
            height: 13px;
            background-color: rgba(255,255,255,0);
            display: flex;
        }
        .banner ol li {
            
            margin: 3px;
            width: 8px;
            height: 8px;
            background-color: #fff;
            border-radius: 50%;
            cursor: pointer;
        }
        .banner ol .active{
            background-color: #ff5000;
        }
    </style>
</head>
<body>
    <div class="banner">
        <ul>
            <li><a href="#"><img src="./images/2.jpg" alt=""></a></li>
            <li><a href="#"><img src="./images/3.jpg" alt=""></a></li>
            <li><a href="#"><img src="./images/1.jpg" alt=""></a></li>
        </ul>
        <!-- 注意这边可以去阿里图标库中寻找图标,然后导入
        这边使用简易版本 -->
        <a href="#" class="zuo"><</a>
        <a href="#" class="you">></a>
        <ol>
            <li class="active"></li>
            <li></li>
            <li></li>
        </ol>
    </div>
</body>
</html>
相关推荐
西西木科技丨Shopify开发机构5 分钟前
如何在 Shopify 中建立重定向
前端·html
汪子熙12 分钟前
深入探析 header facets:定位与应用
前端·javascript
你听得到1113 分钟前
从需求到封装:手把手带你打造一个高复用、可定制的Flutter日期选择器
前端·flutter
江城开朗的豌豆17 分钟前
Vue Router vs location.href:导航跳转的正确姿势,你选对了吗?
前端·javascript·vue.js
小磊哥er22 分钟前
【前端工程化】如何制定前端项目中的页面模版?
前端
Liudef0625 分钟前
基于HTML与Java的简易在线会议系统实现
java·前端·html
2401_8812444028 分钟前
javaweb———html
前端·javascript·html
江城开朗的豌豆28 分钟前
玩转Vue Router:这些实用组件让你的SPA如虎添翼!
前端·javascript·vue.js
前端小巷子32 分钟前
Web开发中的文件下载
前端·javascript·面试
peakmain939 分钟前
Gradle 8.11.1的升级之旅
前端