twitter-bootstrap 引导程序用列填充空白空间
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/32627819/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
bootstrap fill empty space with columns
提问by Valeklosse
Im trying to simulate a grid using bootstrap, I have a slight problem with placing one of the columns.
我试图使用引导程序模拟网格,我在放置其中一列时遇到了一个小问题。
I have tried messing around with placement of the divs and offsets/pulls but with no luck.
我试过摆弄 div 和偏移/拉动的位置,但没有运气。
To clarify what I would like to achieve, in the middle column there should be three blocks of the same height, at the moment there is a gap in the middle. Columns should fill available space if possible. Similar to below (not to scale).
为了澄清我想要实现的目标,在中间的列中应该有三个高度相同的块,此时中间有一个间隙。如果可能,列应填满可用空间。类似于下面(不按比例)。
http://www.bootply.com/KeQzWKbzPG
http://www.bootply.com/KeQzWKbzPG
css
css
.grid-item--height2 { height: 202.5px; }
.grid-item--height5 { height: 405px; }
.grid-item--height7 { height: 607.5px; }
.tile {border:2.5px solid white; }
.blue-background {background-color:blue;}
.orange-background {background-color:orange;}
html
html
<html>
<body>
<div class="container-fluid">
<div class="row-fluid">
<div class="col-md-5 grid-item--height2 blue-background tile text-center">
</div>
<div class="col-md-5 grid-item--height2 blue-background tile text-center">
</div>
<div class="col-md-2 grid-item--height2 orange-background tile text-center">
</div>
<div class="col-md-4 grid-item--height7 blue-background tile text-center">
</div>
<div class="col-md-4 grid-item--height2 blue-background tile text-center">
</div>
<div class="col-md-4 grid-item--height5 blue-background tile text-center">
</div>
<div class="col-md-4 grid-item--height2 blue-background tile text-center">
</div>
<div class="col-md-4 grid-item--height2 blue-background tile text-center">
</div>
<div class="col-md-4 grid-item--height2 blue-background tile text-center ">
</div>
</div>
</div>
</body>
</html>
回答by ShivangiBilora
回答by AngularJR
Valeklosse, have a look at this Fiddle.
Is this what you are trying to achieve here, when you say all 3 blocks of the same height should be in the middle column?
Valeklosse,看看这个小提琴。
当您说所有 3 个相同高度的块都应该在中间列时,这就是您要在这里实现的目标吗?
<div class="container-fluid">
<div class="row-fluid">
<div class="col-md-5 grid-item--height2 blue-background tile text-center">
</div>
<div class="col-md-5 grid-item--height2 blue-background tile text-center">
</div>
<div class="col-md-2 grid-item--height2 orange-background tile text-center">
</div>
<div class="col-md-4 grid-item--height7 blue-background tile text-center">
</div>
<div class="row col-md-4">
<div class="col-md-12 grid-item--height2 blue-background tile text-center">
</div>
<div class="col-md-12 grid-item--height2 blue-background tile text-center">
</div>
<div class="col-md-12 grid-item--height2 blue-background tile text-center">
</div>
</div> <!-- End Row-->
<div class="col-md-4 grid-item--height5 blue-background tile text-center">
</div>
<div class="col-md-4 grid-item--height2 blue-background tile text-center ">
</div>
</div> <!-- End Row-Fluid-->
</div> <!-- End Container-Fluid-->


