【发布时间】:2017-01-09 13:05:42
【问题描述】:
我想像 bootstrap 一样对齐我的图像,但我不能使用 bootstrap 来做到这一点,因为用户可以选择调整图像大小并使用 Bootstrap 类“col-md、col-xs 等”。用户无法调整图像宽度,我尝试创建一个宽度为 100% 的 div,然后将宽度:25% 添加到每个图像(我希望每行 4 个图像),并且图像大小正确但不在正确的位置。
这是我目前拥有的:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://getbootstrap.com/dist/js/bootstrap.min.js"></script>
<link href="https://getbootstrap.com/dist/css/bootstrap.min.css" rel="stylesheet" />
<div class="container">
<div class="row">
<h2>Without Bootstrap</h2>
<div class="">
<img class="responsive" src="https://www.webkit.org/blog-files/acid3-100.png" style="width:250px; height:250px;" />
</div>
<div class="">
<img class="responsive" src="https://www.webkit.org/blog-files/acid3-100.png" style="width:250px; height:250px;" />
</div>
<div class="">
<img class="responsive" src="https://www.webkit.org/blog-files/acid3-100.png" style="width:250px; height:250px;" />
</div>
<div class="">
<img class="responsive" src="https://www.webkit.org/blog-files/acid3-100.png" style="width:250px; height:250px;" />
</div>
</div>
</div>
这是我想要的与我拥有的示例
提前致谢。
【问题讨论】:
-
你不能用宽度调整图像大小吗:25% !important;覆盖引导默认值?
-
我得到了同样的结果
-
唯一的区别是Bootstrap在列上使用
float:left