纯css3的网站轮播图animation练习2

复制代码
<!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>
        *{
            padding: 0;
            margin: 0;
        }
        body{
            width: 100vw;
            height: 100vh;
            display: grid;
        }
        main{
            width: 300px;
            height: 300px;
            display: grid;
            justify-self: center;
            align-self: center;
            overflow: hidden;
            position: relative;
        }
        section{
            width: 1200px;
            height: 300px;
            animation-name: yd;
            animation-duration: 8s;
            animation-iteration-count: infinite;
            display: flex;
            flex-direction: row;
            animation-timing-function: steps(4,end);
            position: relative;
            z-index: 88;
        }
        section:hover,
        section:hover+ul::after{
            animation-play-state: paused;
        }
        div{
            width: 300px;
            background: yellow;
            border: solid 1px #000;
            box-sizing: border-box;
            text-align: center;
            position: relative;
            overflow: hidden;
        }
        ul{
            width: 120px;
            background: rgba(0, 0, 0, 0.5);
            display: flex;
            flex-direction: row; 
            position: absolute;
            bottom:0;
            right: 0;
            z-index: 99;
     
        }
        ul li{
            width: 30px;
            height: 30px;
            line-height: 30px;
            text-align: center;
            list-style:none;
            color:#fff;
            border: 1px solid #fff;
        }
        ul::after{
            content: '';
            width: 30px;
            height: 30px;
            background: orange;
            animation-name: num;
            animation-duration: 8s;
            animation-timing-function: steps(4,end);
            animation-iteration-count: infinite;
            position: absolute;
            left: 0;
            top: 0;
            z-index: -1;
        }
        @keyframes yd {
            to{
                transform: translateX(-1200px);
            }
        }
        @keyframes num {
            to{
                transform: translateX(120px);
            }
        }
 
        img{
            width: 100%;
            height: 100%;
        }
    </style>
</head>
<body>
    <main class="main">
        <section>
            <div><img src="images/1.png" alt=""></div>
            <div><img src="images/2.png" alt=""></div>
            <div><img src="images/3.png" alt=""></div>
            <div><img src="images/4.png" alt=""></div>
        </section>
        <ul>
            <li>1</li>
            <li>2</li>
            <li>3</li>
            <li>4</li>      
        </ul>
    </main>
        
</body>
</html>
相关推荐
码农黛兮_461 小时前
4. 文字效果/2D-3D转换 - 3D翻转卡片
3d·html·css3
水银嘻嘻4 小时前
12 web 自动化之基于关键字+数据驱动-反射自动化框架搭建
运维·前端·自动化
小嘟嚷ovo4 小时前
h5,原生html,echarts关系网实现
前端·html·echarts
十一吖i5 小时前
Vue3项目使用ElDrawer后select方法不生效
前端
只可远观5 小时前
Flutter目录结构介绍、入口、Widget、Center组件、Text组件、MaterialApp组件、Scaffold组件
前端·flutter
周胡杰5 小时前
组件导航 (HMRouter)+flutter项目搭建-混合开发+分栏效果
前端·flutter·华为·harmonyos·鸿蒙·鸿蒙系统
敲代码的小吉米5 小时前
前端上传el-upload、原生input本地文件pdf格式(纯前端预览本地文件不走后端接口)
前端·javascript·pdf·状态模式
是千千千熠啊5 小时前
vue使用Fabric和pdfjs完成合同签章及批注
前端·vue.js
九月TTS6 小时前
TTS-Web-Vue系列:组件逻辑分离与模块化重构
前端·vue.js·重构
我是大头鸟6 小时前
SpringMVC 内容协商处理
前端