0
点赞
收藏
分享

微信扫一扫

代码随想录算法训练营第七天|哈希表理论基础,454.四数相加II ,383. 赎金信 ,15. 三数之和 ,18. 四数之和

皮皮球场 2024-01-13 阅读 9
css3

代码如下:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>轮播</title>
    <style>
        .boss {
            position: relative;
            width: 200px;
            height: 200px;
            overflow: hidden;
        }
        .boss>div {
            width: 10000px;
            height: 200px;
            border: 1px solid #000;
        }
        .box {
            display: flex;
            position: absolute;
            top: 0;
            left: 0;
        }
        .box>div {
            width: 200px;
            height: 200px;
            animation: move 10s infinite ease-out;
        }
        /* 关键帧 平移即可 */
        @keyframes move {
            0% {
                transform: translateX(0%);
            }
            25% {
                transform: translateX(-100%);
            }
            50% {
                transform: translateX(-200%);
            }
            75% {
                transform: translateX(-300%);
            }
            100% {
                transform: translateX(-400%);
            }
        }
    </style>
</head>
<body>
    <div class="boss">
        <div class="box">
            <!-- 第一个背景颜色是pink 最后一个也是pink色 -->
            <div style="background-color: red;"></div>
            <div style="background-color: yellow;"></div>
            <div style="background-color: blue;"></div>
            <div style="background-color: green;"></div>
            <div style="background-color: red;"></div>
        </div>
    </div>
</body>
</html>

样式:

css3轮播样式

上面代码中的:animation: move 10s infinite ease-out;

10s是轮播所用时间。

举报

相关推荐

0 条评论