【发布时间】:2017-02-15 02:00:02
【问题描述】:
我有一个关于使用 flexbox CSS 的 div 滚动条的问题。
我添加了一个例子来说明情况。
* {
box-sizing: border-box;
}
.flex-display {
display: flex;
align-items: stretch;
height: 100%;
}
.tree-container {
border: 1px groove gray;
padding: 10px;
width: 25%;
height: 100%;
}
.detail-container {
border: 1px groove black;
padding: 10px;
width: 75%;
height: 100%;
flex: auto;
}
#ViewContainer {
display: flex;
flex-direction: column;
align-items: stretch;
}
#Header {
border: 1px ridge;
display: block;
}
#Detail {
border: 1px ridge;
overflow-y: auto;
}
<div class="flex-display">
<div class="tree-container">
HERE COMES A TREE
</div>
<div class="detail-container">
<div id="MainContainer">
<div id="ViewContainer">
<div id="Header">
This is going to be my Header View with Fixed Height of Content.
</div>
<div id="Detail">
<h2> Set scrollbar on this div to utilized remaining height of browser window without showing scrollbar on Browser.</h2>
<div>
<p>
HEre we are going to have some divs or some form and some other things but this part has to be scrollable.
</p>
</div>
<div>
<p>
HEre we are going to have some divs or some form and some other things but this part has to be scrollable.
</p>
</div>
<div>
<p>
HEre we are going to have some divs or some form and some other things but this part has to be scrollable.
</p>
</div>
<div>
<p>
HEre we are going to have some divs or some form and some other things but this part has to be scrollable.
</p>
</div>
<div>
<p>
HEre we are going to have some divs or some form and some other things but this part has to be scrollable.
</p>
</div>
<div>
<p>
HEre we are going to have some divs or some form and some other things but this part has to be scrollable.
</p>
</div>
<div>
<p>
HEre we are going to have some divs or some form and some other things but this part has to be scrollable.
</p>
</div>
<div>
<p>
HEre we are going to have some divs or some form and some other things but this part has to be scrollable.
</p>
</div>
<div>
<p>
HEre we are going to have some divs or some form and some other things but this part has to be scrollable.
</p>
</div>
<div>
<p>
HEre we are going to have some divs or some form and some other things but this part has to be scrollable.
</p>
</div>
<div>
<p>
HEre we are going to have some divs or some form and some other things but this part has to be scrollable.
</p>
</div>
<div>
<p>
HEre we are going to have some divs or some form and some other things but this part has to be scrollable.
</p>
</div>
<div>
<p>
HEre we are going to have some divs or some form and some other things but this part has to be scrollable.
</p>
</div>
<div>
<p>
HEre we are going to have some divs or some form and some other things but this part has to be scrollable.
</p>
</div>
<div>
<p>
HEre we are going to have some divs or some form and some other things but this part has to be scrollable.
</p>
</div>
</div>
</div>
</div>
</div>
</div>
您可以在笔中看到它。 CodePen
参考:类似情况,但以另一种方式 flex-direction in row:Scrolling a flexbox with overflowing content
对此的任何意见都将是可观的。
【问题讨论】: