当前位置 : 主页 > 网页制作 > css >

css使Img图片居中显示

来源:互联网 收集:自由互联 发布时间:2021-06-13
div class = " flex-center listing-img " img v- if = " item.imgUrl " v-bind:src= " item.imgUrl " alt= " not find picture " img v- if = " !item.imgUrl " src= " ../../assets/img/detail-not-image.png " alt = " not find picture " v-sf-img/div im
<div class="flex-center listing-img">
    <img v-if="item.imgUrl" v-bind:src="item.imgUrl" alt="not find picture">
    <img v-if="!item.imgUrl" src="../../assets/img/detail-not-image.png"alt="not find picture" v-sf-img>
</div>
 
img1是默认显示图片


.listing-img{
  width:
100%; min-height: 270px; max-height: 320px; } .listing-img>img{   display: inline-block; height: auto; max-width: 100%; max-height: 320px; } .flex-center {   display: flex;   justify-content: center;   align-items: center; }
网友评论