zoukankan      html  css  js  c++  java
  • css之transition上下动画效果

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>css之transition动画效果</title>
        <style>
            body,html{
                position: relative;
            }
            #root{
                position: relative;
                top: 200px;
                left: calc(50% - 150px);
                width: 300px;
                height: 300px;
                background-color: yellow ;
                overflow: hidden;
            }
            #root:hover #box{
                top: 0;
            }
            #box{
                width: 300px;
                height: 300px;
                background-color: skyblue;
                position: absolute;
                top: -100%;
                transition: all ease-in 2s;
            }
            #box button {
                position: absolute;
                bottom: 0;
                right: 0;
            }
            #box:active{
                background-color: red;
            }
        </style>
    </head>
    <body>
        <div id="root">
            <div id="box">
                <button onclick="toBuy()">购买</button>
            </div>
        </div>
    </body>
    </html>
    <script>
        function toBuy(){
            alert('购买成功')
        }
    </script>
  • 相关阅读:
    面试
    二叉树- 二叉树直径
    排序算法
    JAVA编程
    JAVA编程
    JAVA中break和continue的区别
    HTTP的序列化和反序列化
    PL/SQL基础
    G. Game Design
    hdu 6703 array
  • 原文地址:https://www.cnblogs.com/-roc/p/13634838.html
Copyright © 2011-2022 走看看