【发布时间】:2017-11-07 05:43:36
【问题描述】:
我有一个 Bootstrap 网站,它有一个 div 包装器,然后有 1 - 6 个可能的 div。这些是 200 像素宽,需要在内部等距分布。
<div class="container">
<div class="row">
<div class="wasps_home_footer_blocks_container">
<div class="wasps_home_footer_block col-md-2 ">
<figure> <a href="#"><img src="test.jpg" alt="" class="img-responsive"></a>
<figcaption>
<h4>Test link</h4>
</figcaption>
</figure>
</div>
<div class="wasps_home_footer_block col-md-2 ">
<figure> <a href="#"><img src="test.jpg" alt="" class="img-responsive"></a>
<figcaption>
<h4>Test link</h4>
</figcaption>
</figure>
</div>
<div class="wasps_home_footer_block col-md-2 ">
<figure> <a href="#"><img src="test.jpg" alt="" class="img-responsive"></a>
<figcaption>
<h4>Test link</h4>
</figcaption>
</figure>
</div>
<div class="wasps_home_footer_block col-md-2 ">
<figure> <a href="#"><img src="test.jpg" alt="" class="img-responsive"></a>
<figcaption>
<h4>Test link</h4>
</figcaption>
</figure>
</div>
</div>
</div>
CSS:
.wasps_home_footer_blocks_container {
width: 100%;
margin: auto;
margin-top: auto;
margin-top: 20px;
}
.wasps_home_footer_block {
width: 200px;
text-align: center;
}
这显示了四个 div,但在 .wasps_home_footer_blocks_container div 中左对齐。 wasps_home_footer_block div 需要位于包含 div 的中间,等间距。 (见附图)
【问题讨论】:
标签: html css twitter-bootstrap