Responsive images inline-block in a div with Bootstrap

前端 未结 2 1626
悲&欢浪女
悲&欢浪女 2021-01-04 04:31

I am new in Bootstrap, I am trying to do this responsive: A div, with 3 images centered (images have display: inline-block propertie).

But when I start resizing, in

2条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-04 05:17

    In the case of responsive images, the image(s) need an individual container that they can be sized into. In the example you have, there are three images in the one container, so they won't adapt individually to that single container. You could try something like:

    .row li {
      width: 33.3%;
      float: left;
    }
    
    img {
      border: 0 none;
      display: inline-block;
      height: auto;
      max-width: 100%;
      vertical-align: middle;
    }
    • Responsive image
    • Responsive image
    • Responsive image

提交回复
热议问题