html图片上下左右居中

    xiaoxiao2021-03-25  420

    实现效果如图:

    原图:

    .img-box{ width: 100%; height: 100%; overflow: hidden; position: relative; background-position: 50% 50%; background-repeat: no-repeat; } 横向:

    <div class="card-img-box" style="background-image: url(../img/muwu.jpg); background-size:auto 100%;"> 纵向:

    <div class="card-img-box" style="background-image: url(../img/login-1.png);background-size:100% auto;">

    转载请注明原文地址: https://ju.6miu.com/read-67.html

    最新回复(0)