[英]How can I make images responsive height and width in row - bootstrap 4
I'm working on a project and I need to display the images the same height in the row column.我正在处理一个项目,我需要在行列中显示相同高度的图像。
Below is my code:下面是我的代码:
<div class="row">
<div class="content adjustment col-lg-6">
<a href=""><img class="image image1 img-responsive" src="images/assets/one.png" /></a>
<div class="on_hover">
<div class="text">Lorem ipsum dolor sit amet, consectetur adipiscing elit. </div>
</div>
</div>
<div class="content adjustment higher col-lg-3">
<a href=""><img class="image image2 img-responsive" src="images/assets/two.png"
style="width:100%;height:80%;" /></a>
<div class="on_hover">
<div class="text">Lorem ipsum dolor sit amet, consectetur adipiscing elit. </div>
</div>
</div>
<div class="content adjustment col-lg-3">
<a href=""><img class="image img-responsive" src="images/assets/three.png" style="width:100%;height:80%;" /></a>
<div class="on_hover">
<div class="text">Lorem ipsum dolor sit amet, consectetur adipiscing elit. </div>
</div>
</div>
</div>
<div class="row">
<div class="content adjustment col-lg-6">
<a href=""><img class="image image1 img-responsive" src="https://via.placeholder.com/500" style="width:100%;height:auto;" /></a>
<div class="on_hover">
<div class="text">Lorem ipsum dolor sit amet, consectetur adipiscing elit. </div>
</div>
</div>
<div class="content adjustment higher col-lg-3">
<a href=""><img class="image image2 img-responsive" src="https://via.placeholder.com/150"
style="width:100%;height:auto;" /></a>
<div class="on_hover">
<div class="text">Lorem ipsum dolor sit amet, consectetur adipiscing elit. </div>
</div>
</div>
<div class="content adjustment col-lg-3">
<a href=""><img class="image img-responsive" src="https://via.placeholder.com/150" style="width:100%;height:auto;" /></a>
<div class="on_hover">
<div class="text">Lorem ipsum dolor sit amet, consectetur adipiscing elit. </div>
</div>
</div>
</div>
Replace the img-responsive to img-fluid .将img-responsive替换为img-fluid 。
In bootstrap 3 we used img-responsive
for the responsive image but is is changed in bootstrap 4.在 bootstrap 3 中,我们使用
img-responsive
作为响应式图像,但在 bootstrap 4 中进行了更改。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.