【发布时间】:2017-07-04 04:25:20
【问题描述】:
我编写了一个代码,其中 4 个图像在 cols 中并排保存在 div 中。
下面是代码:
<div class="container-fluid">
<div class="row">
<div class="col-xs-3 col-sm-3 col-md-3">
<img src="image2.jpg" alt="1" style="width:100%; height:70%;" class="img-responsive" />
</div>
<div class="col-xs-3 col-sm-3 col-md-3">
<img src="image3.jpg" alt="1" style="width:100%; height:70%;" class="img-responsive"/>
</div>
<div class="col-xs-3 col-sm-3 col-md-3">
<img src="image4.jpg" alt="1" style="width:100%; height:70%;" class="img-responsive"/>
</div>
<div class="col-xs-3 col-sm-3 col-md-3">
<img src="image5.jpg" alt="1" style="width:100%; height:70%;" class="img-responsive"/>
</div>
</div>
</div>
这在全尺寸窗口中看起来像这样:
现在当窗口最小化时,图像看起来像这样:
我希望图像看起来像它在完整尺寸下的样子,即使在最小化之后图像也不会被拉伸。
当我删除样式时,我能够在没有拉伸的情况下获得上述图像的视图:width:100%;身高:70%;但是在全尺寸窗口中,图像之间有空格。
请帮我解决这个问题。
【问题讨论】:
-
你试过
height: auto;吗? -
这个@James 好运吗?我的方法适用于您当前的设置吗?
-
@FredRocha 嘿 Fred,我尝试仅使用 img-reponsive 并丢失了内联样式,但随后图像在全屏窗口大小下看起来像这样:(检查下方)
-
图像只会调整到最大宽度(否则它们会变得模糊)。确保使用更宽的图像,或限制容器或行。
-
那么我如何限制容器或行?
标签: html css image twitter-bootstrap-3