【发布时间】:2015-07-23 07:04:12
【问题描述】:
使用 Bootstrap 3.x 并创建一个常见的 3 列布局。在桌面视图中,我希望所有三个 div 位于同一行且高度相同。当缩小到最小宽度时,我希望前两个 div 始终彼此相邻,但第三个放在下方。始终,前两个 div 应该是相同的高度。如果第二个 div 比第一个短,则第三个 div 在第二个的下方,在第一个的右侧。
<div class="row">
<div class="col-sm-12 col-md-9">
<!-- keep these two divs together side by side and the same height -->
<div class="col-xs-6 col-sm-6 col-md-6">
this is panel one
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
this is panel two
</div>
</div>
<div class="col-sm-12 col-md-3">
<!-- this div should be beside the other two on large screens and drop below on xsmall screens -->
side bar ad
</div>
</div>
这是可视化问题的另一种方法。前两个需要高度相同:http://www.bootply.com/29cNrJrEwT
【问题讨论】:
-
感觉就像是在请人为您完成这项工作,而不是真正提出问题。
-
没有。它被称为在过去的 6 个小时里我一直在反复试验,但仍然无法让它工作。正如许多人所说,您会认为通过 Bootstrap 3 有人会添加等高 div 作为标准功能。
-
这就是创建flexbox 的原因。这并不像看起来那么难。
标签: css twitter-bootstrap