zoukankan      html  css  js  c++  java
  • 背景图滚动translateY代替background-position更优

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>doc</title>
        <style>
            *,
            *:before,
            *:after {
                box-sizing: border-box;
            }
            .pen {
                background-color: blue;
                position: absolute;
                top: 0px;
                left: 0px;
                height: 100%;
                width: 100%;
            }
            .panel {
                padding: 3rem;
                height: 50%;
            }
            .top {
                background-color: #3e69c3;
                background-image: url(http://scarbroughstudios.com/img/codepen.svg);
                background-position: center center;
                background-size: 500px;
                animation: scrollBad 5s linear infinite;
            }
            .bottom {
                background-color: #31cc70;
                overflow: hidden;
                position: relative;
            }
            .bottom .scroll {
                background-image: url(http://scarbroughstudios.com/img/codepen.svg);
                background-position: center center;
                background-size: 500px;
                position: absolute;
                top: 0px;
                left: 0px;
                height: 400%;
                width: 100%;
                z-index: 1;
                animation: scrollGood 5s linear infinite;
            }
            h1 {
                color: white;
                font-weight: 400;
                font-family: sans-serif;
                margin: 0;
                position: relative;
                z-index: 2;
            }
            @keyframes scrollBad {
                0% {
                    background-position: 0 0;
                }
                100% {
                    background-position: 0 -320px;
                }
            }
            @keyframes scrollGood {
                0% {
                    transform: translateY(0);
                }
                100% {
                    transform: translateY(-320px);
                }
            }
        </style>
    </head>
    <body>
        <h1>test</h1>
        <section class="pen">
            <div class="panel top">
                <h1>Animate: background-position</h1>
            </div>
            <div class="panel bottom">
                <h1>Animate: translateY</h1>
                <div class="scroll"></div>
            </div>
        </section>
    </body>
    </html>

     出处: https://wow.techbrood.com/fiddle/9614

  • 相关阅读:
    pikachu---RCE
    pikachu---SQL注入(2)
    pikachu---SQL注入(1)
    pikachu---CSRF
    Pikachu:XSS-盲打、过滤、htmlspecialchars、href与js输出
    xss搭建,cookie获取,钓鱼,键盘记录
    pikachu ------xss漏洞(几中类型简单的介绍)
    验证码绕过
    破解版BrupSuite安装及其问题解决及环境部署
    Pikachu的暴力破解演示-----基于表单的暴力破解
  • 原文地址:https://www.cnblogs.com/mengff/p/14943192.html
Copyright © 2011-2022 走看看