Bootstrap 3网格:一行内的列下的列

时间:2013-12-27 22:04:40

标签: css twitter-bootstrap multiple-columns

我有以下HTML代码:

<div class="row">
<div class="col-lg-3">
 <div class="panel panel-default">
  <div class="panel-body">
    Panel 1 (left)
    </div>
  </div>
</div> 

<div class="col-lg-6">
 <div class="panel panel-default">
  <div class="panel-body">
    Panel 2 (center)
    </div>
   </div>
 </div>
</div>

<div class="col-lg-3">
 <div class="panel panel-default">
  <div class="panel-body">
    Panel 3 (right)
    </div>
   </div>
 </div>
</div>

</div>

<div class="row">
<div class="col-lg-3">
 <div class="panel panel-default">
  <div class="panel-body">
    Panel 2-2 (under panel 2)
    </div>
  </div>
</div>
</div> 

最终结果应如下所示:
它有效,但如果面板3的高度比面板1或2高,我得到这个:

我该如何解决?

1 个答案:

答案 0 :(得分:9)

这就是你应该如何做到这一点,将Panel 2-2嵌套在Panel 2下,而不是让它位于最后,这不是你想要的。这是Bootply:http://bootply.com/102721

<强>代码

<div class="row">
    <div class="col-lg-3">
        <div class="panel panel-default">
            <div class="panel-body">Panel 1 (left)</div>
        </div>
    </div>
    <div class="col-lg-6">
        <div class="panel panel-default">
            <div class="panel-body">Panel 2 (center)</div>
        </div>
        <div class="col-lg-3">
            <div class="panel panel-default">
                <div class="panel-body">Panel 2-2 (under panel 2)</div>
            </div>
        </div>
    </div>
    <div class="col-lg-3">
        <div class="panel panel-default">
            <div class="panel-body">Panel 3 (right)
                <br>Panel 3 (right)
                <br>Panel 3 (right)
                <br>Panel 3 (right)
                <br>Panel 3 (right)
                <br>Panel 3 (right)
                <br>Panel 3 (right)
                <br>Panel 3 (right)
                <br>Panel 3 (right)
                <br>Panel 3 (right)
                <br>Panel 3 (right)
                <br>
            </div>
        </div>
    </div>
</div>

<强>演示

enter image description here