手风琴html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style type="text/css">
    *{
        margin: 0;
        padding: 0;
    }
    .box{
        background-image: linear-gradient(#78f, #f78);
        display: flex;
        height: 100vh;
        align-items: center;
        justify-content: center;
    }
    .box ul{
        overflow: hidden;
        /* width=5*200,hover可重新定义宽度 */
    }
    .box ul li{
        width: 200px;
        height: 320px;
        float: left;
        list-style: none;
        position: relative;
    }
    .box ul li p{
        position: absolute;
        left: 0;
        bottom: 0;
        width: 100%;
        line-height: 320px; 
        font-size: 14px; 
        background-color: rgba(0, 0, 0, .3);
        text-align: center;
        
        font-weight: 700;
        color: white;
    }
    .box ul li:hover p{
        font-size: 20px;
        line-height: 30px;
        transition: all .3s;
    }
    .box ul:hover li{
        width: 90px;
        transition: all .3s;

    }
    .box ul li:hover{
        width: 640px;
        transition: all .3s;
    }
   /*  .box ul li:not(:hover){
        width: 90px;
        transition: all .3s;
    } */
    
    
    
    </style>
</head>
<body>
    <div class="box">
        <ul>
          <li>
            <img src="C:\Users\CJ\Desktop\images/1.jpg" alt="" />
            <p>玩具总动员</p>
          </li>
          <li>
            <img src="C:\Users\CJ\Desktop\images/2.jpg" alt="" />
            <p>汽车总动员</p>
          </li>
          <li>
            <img src="C:\Users\CJ\Desktop\images/3.jpg" alt="" />
            <p>仙境的彼方</p>
          </li>
          <li>
            <img src="C:\Users\CJ\Desktop\images/4.jpg" alt="" />
            <p>飞屋环游记</p>
          </li>
          <li>
            <img src="C:\Users\CJ\Desktop\images/5.jpg" alt="" />
            <p>机器人总动员</p>
          </li>
        </ul>
      </div>
</body>
<script>
    
</script>
</html>

注意事项:
1.:hover前面千万别加空格否则失效

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值