【发布时间】:2019-10-28 23:50:50
【问题描述】:
我想要一个 DIV 100% 高度的页面,并带有 2 个响应列。右边的那个应该是固定的,没有滚动(作为菜单)。右边的应该是可滚动的,左列是独立的。我正在使用 Bootstrap 3 使列具有响应性
______________________________
| | |
| | |
| | |
| | y-scroll |
| | |
| no scroll | |
| vertical | |
| centering | |
| | |
| | |
| | |
| | |
------------------------------
=== 更新 ======
这是我的第二次尝试:
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<div style="display:flex; height:100px; min-height:0; min-height: 100%; width:100%;">
<div class="row">
<!-- left -->
<div class="col-md-2">
<div style="flex-direction:column; background-color:red; display:flex; height:100%; justify-content: center;">
<h1 style="color:white;"> I should be fixed and centered</h1>
</div>
</div>
<!-- right -->
<div class="col-md-10">
<div style="flex-direction:column; flex:1; max-height:100%; overflow-y: scroll; background-color:green;">
<h1 style="color:white; margin-bottom:600px;"> I should be > 100% height, and scrollable</h1>
<h1 style="color:white; margin-bottom:600px;"> I should be > 100% height, and scrollable</h1>
</div>
</div>
</div>
</div>
【问题讨论】:
-
结合 Bootstrap 3(基于
float)和 Flexbox 是个坏主意。而是使用 Bootstrap 4(基于 Flexbox) -
谢谢,在我的下一次更新中,我将使用 Bootstrap 4。我需要这个技巧快速浏览一页
标签: css twitter-bootstrap-3 flexbox