实例

代码

<!DOCTYPE html>

<html>
    <head>
        <meta charset="UTF-8">
        <title>小米商品展示css3动画</title>
        <style>
*{
            margin: 0;
            padding: 0;
        }
        
        body{
            background-color: #F5F5F5;
        }

        #box .box-con{
            width: 294px;
            height: 375px;
            background-color: white;
        }
        
        #box .box-con .new{
            width: 80px;
            height: 25px;
            background-color: #83c44e;

            margin-left: 106px;
            color: white;
            line-height: 25px;
            font-size: 14px;
            text-align: center;
        }
        
        #box .box-con a img{
            max-width: 150px;
            display: block;
            margin-bottom: 28px;
            margin-top: 50px;
            margin-left: 70px;
            
        }
        
        #box .box-con a.name{
            
            margin-top: 25px;
            margin-left: 97px;
            text-align: center;
            text-decoration: none;
            color: #000000;
        }
        
        #box .box-con p{
            margin-top: 1px;
            margin-left:10px;
            color: #B0B0B0;
            font-size: 13px;
            text-align: center;
        }
        
        #box .box-con .price{
            
            margin-top: 10px;
            margin-left: 129px;
            color: #FF6700;
            font-size: 13px;
        }
        
        #box .box-con .say{
            
            background-color: #FF6700;
            /*width:294px ;
            height: 95px;*/
            position: absolute;
            bottom: 24px;
            width:0px ;
            height: 1px;
            transition: all 0.5s;
        }
        
    
        #box{
            position: relative;
            width: 294px;
            height: 375px;
            /*outline: 1px solid black;*/
            margin: 150px auto;
            transition: margin-top 0.5s;
            transition: all 0.5s;
        }
        
        
        #box:hover .say{
            border: 1px solid red;
            width: 294px;
            height: 95px;
            right: 0px;
            bottom: 0px;
        }
        
        #box:hover{
            margin-top: 145px;
            box-shadow: 0px 0px 25px  rgba(46,46,46,0.2);
            
        }
        
        
    </style>
</head>
<body>

    <div id="box">
        <div class="box-con">
            <div class="new">新品</div>
            <a href=""> <img src="https://cdn.cnbj0.fds.api.mi-img.com/b2c-shopapi-pms/pms_1632300679.07576831.jpg" /></a>
            <a href="" class="name">米家感应夜灯</a>
            <p>超低功耗,亮度双档调节,可贴可挂</p>
            <div class="price">49元</div>
            <div class="say">
                
            </div>

        </div>
    </div>
</body>
</html>
如果觉得我的文章对你有用,可以赞助本站,使本站更好的发展