用改变的方式使其其移动

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style>
        body{
            background-color: #F5F5F5;
        }

        div{
            transition: all .3s;
        }

        .box{
            width: 200px;
            height: 250px;
            background-color: #fff;
            margin: 10px auto;
            transform:  translate(0,0);
            overflow:hidden;
        }

        .box:hover{
            box-shadow:2px 5px 25px 1px red;
            transform:translate(0,-3px);
            /*transform: translateX(10px);
            transform: translateY(20px);
            transform: translate(20px,30px);*/
        }

        .desc{
            width: 200px;
            height:50px;
            background-color: orange;
            position:absolute;
            bottom:0%;
            transform: translate(0,50px);
            opacity: 0;
        }

        .box:hover .desc{
            transform: translate(0,0);
            opacity: 1;
        }

    </style>
</head>
<body>
    <!-- 
        改变,  使...变形
        transform     
                translate(X,Y)    移动
                translateX    移动
                translateY    移动

     -->

    <div class='box'>
        <div class='desc'></div>
    </div>

</body>
</html>
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容