我正在学习如何使用 Bootstrap。目前,我正在艰难地进行布局。虽然 Bootstrap 非常酷,但我看到的一切似乎都过时了。对于我的生活,我有一个我认为是我无法弄清楚的基本布局。我的布局如下所示:
---------------------------------------------------------------------------
| | | |
| | | |
| 240px | 160px | All Remaining Width of the Window |
| | | |
| | | |
--------------------------------------------------------------------------|
该网格需要占据窗口的整个高度。根据我的理解,我需要混合固定宽度和流动宽度。然而,Bootstrap 3.0似乎不再有fluid类了。即使确实如此,我似乎也无法弄清楚如何混合流体和固定的柱尺寸。有谁知道如何在 Bootstrap 3.0 中做到这一点?
edit:由于很多人似乎都想这样做,因此我在这里编写了一份简短的指南,其中包含更通用的用例https://www.atlascode.com/bootstrap-fixed-width-sidebars/ https://www.atlascode.com/bootstrap-fixed-width-sidebars/.
Bootstrap3 网格系统支持行嵌套,允许您调整根行以允许固定宽度的侧面菜单。
您需要在根行上放置一个 padding-left ,然后有一个包含正常网格布局元素的子行。
我通常是这样做的http://jsfiddle.net/u9gjjebj/ http://jsfiddle.net/u9gjjebj/
html
<div class="container">
<div class="row">
<div class="col-fixed-240">Fixed 240px</div>
<div class="col-fixed-160">Fixed 160px</div>
<div class="col-md-12 col-offset-400">
<div class="row">
Standard grid system content here
</div>
</div>
</div>
</div>
css
.col-fixed-240{
width:240px;
background:red;
position:fixed;
height:100%;
z-index:1;
}
.col-fixed-160{
margin-left:240px;
width:160px;
background:blue;
position:fixed;
height:100%;
z-index:1;
}
.col-offset-400{
padding-left:415px;
z-index:0;
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)