简体   繁体   中英

How to make some image fit with the bootstrap columns with auto zoom image to fill the column

图像适合并用缩放填充列

这是手机打开时的图片,我想要这样

这是我尝试 100% 拟合时的结果

And this is my code:

<div class="row">
    <div class="col-12">
      <div class="row">
        <div class="col-lg-6 col-md-6 col-sm-12">
          <div class="xon-card">
            <img class="img-fluid" src="https://www.adidas.co.id/media/scandiweb/slider/9/6/960x500_3_.jpg" alt="">
          </div>
        </div>
        <div class="col-lg-6 col-md-6 col-sm-12">
          <img class="img-fluid" src="https://www.adidas.co.id/media/scandiweb/slider/m/e/mermaid--teaser-update-5.jpg" alt="">
        </div>
      </div>
    </div>
  </div>

After that I want to make some button like that

I'm using bootstrap 5.

I guess you can handle it by flex-wrap . See the link below.

https://getbootstrap.com/docs/4.0/utilities/flex/#wrap

add style to img:

width: 100%;
height: 100%;
object-fit: cover;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM