I want to go from this
to this
In the first one, the img
is responsive widthly. Its width
is set to 100%, using bootstrap's .img-responsive
.
However, to achieve the desired effect in second pic, we have to leave out part of the images'. To do this, one approach is to set the container of img to a fixed width and height, code goes like this:
<div class="col-md-9">
<div class="col-md-4 img-container">
<img src="" class="img-responsive">
</div>
<div class="col-md-4"></div>
<div class="col-md-4"></div>
</div>
(To use folloing approach, delete the `img-responsive' helper above.)
.img-container{
height: 148px;
width: 148px;
img{
max-height: 100%;
max-width: 100%;
vertical-align: middle;
}
}
However, using Bootstrap's grid to define every <div>
's width.,I don't want to set its witdh and height to a fixed value. That is, I want each <img>
or its container to scale according to the col-md-*
.
How can I do that, without using fixed width and height? Or put it simply, to set the height according to the width? (or just how to make a square)