css+div 控件重叠,子控件隐藏

https://blog.51cto.com/u_16281588/9721961


 

 <div  class = "list-image-parent" >

                          <img class="img2" :src="image.img">

                          <div class = "mask">{{ image.desc }}</div>

     </div>

 .list-image-parent{



      height: 200px;

      margin-bottom: 15px;



      /**重要!!!! */

      position: relative; /* 相对定位 */

      overflow: hidden;   /**子控件超出隐藏 */



    }



    .list-image-parent:hover .mask{



      top:50%;

        /* 添加过渡 */

      transition: all 0.5s ease-out;

     

    }



  .img2{

    width: 100%;

    height: 200px;;

    object-fit:cover;

    border-radius:5px;

  }





   .mask{

    position: absolute;

    top: 100%;

    height: 50%; /* 子控件高度与父控件相同 */

    width: 100% - 30px;

    padding-left: 15px;

    padding-right: 15px;

    display: flex;

    justify-content: center;

   

    opacity: 0.9;

    color: white;

    display: flex;



    align-items: center;  

    flex-direction: column;



    padding-left: 10px;

    padding-right: 10px;



    background: #000000;



    border-radius: 0px 0px 8px 8px;



     /* 添加过渡 */

     transition: all 0.5s ease-in;

  }

  • 3
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值