使用Bootstrap4创建双列布局,左列应该滚动(当前不是),右列不应该滚动(目前它按照滚动条在图像中)。地图应该始终是窗口的高度(我认为在Bootstrap中称为“视口”)。仅供参考,左栏中的内容随时间而作为服务器推出更多的主机到它:Bootstrap4 - 2列:左滚动,右固定映射
HTML:
<div id="app">
<div class="container-fluid">
<div class="row">
<div class="col-md-2">list of hosts (should scroll)</div>
<div class="col-md-10" id="map">google map (should NOT scroll)</div>
</div>
</div>
</div>
CSS:
.col-md-2 {
border-right: 1px solid black;
min-height: 100vh;
overflow-y: scroll;
padding: 0;
}
感谢
作为一个快速提示,偏移类应该会在下一个Beta版本中出现,所以你应该用'offset-2'来代替'ml-auto'类。 –
谢谢,泰森。除了你的代码之外,在'#map'中添加'min-height:100vh;'使它工作。 “ml-auto”的工作是什么? –
ml-auto将左边距设置为自动。这就是当前Beta如何将内容推向右侧,而不是Alpha使用的偏移类 –