zoukankan      html  css  js  c++  java
  • #transform #transition 通过类名实现文字动画过渡

    代码

    <!DOCTYPE html>
    <html>
    
    <head>
        <style>
            div {
                display: flex;
                justify-content: center;
                align-items: center;
                position: absolute;
                top: 200px;
                 300px;
                height: 300px;
    
    
                background: red;
                transition: width .5s,transform .5s,top .5s,height .5s;
            }
    
            .customStyle {
    
                top: 200px;
                 300px;
                height: 100px;
                transform: translateX(500px);
            }
        </style>
    </head>
    
    <body>
    
        <div id="test">
            <h1>我是中国人</h1>
        </div>
    
        <button onClick="trigger()">点击</button>
        <button onClick="triggeroff()">移出</button>
        <script>
            function trigger() {
    
                document.getElementById("test").classList.add("customStyle")
            }
            function triggeroff() {
    
                document.getElementById("test").classList.remove("customStyle")
            }
        </script>
    </body>
    
    </html>
    
  • 相关阅读:
    STM32-串口通信
    STM32-系统计时器(systick)
    字符串操作常用的函数
    基本MarkDown语法
    结构
    python入门
    贪心算法小结
    POJ1631_高深DP
    POJ3046ANT_COUNTING
    POJ1742coins
  • 原文地址:https://www.cnblogs.com/jaycethanks/p/12829077.html
Copyright © 2011-2022 走看看