【发布时间】:2018-02-09 21:53:34
【问题描述】:
我需要一个可以根据浏览器大小进行缩放的侧边菜单。但我还需要页眉和页脚,以及旁边菜单旁边的内容容器。假设侧边菜单是宽度的 1/4,内容容器是宽度的 3/4,但侧边菜单和内容容器的高度始终是浏览器大小的 100% 或更高,具体取决于内容容器和侧边菜单中的内容。
我认为这很简单,只要有 flext-dir。上校和孩子们的“flex:1”。 (还有一点代码,在小提琴链接下面)
但是一旦我将侧边菜单包装在一个新的 div 中,我就可以使内容容器靠近侧边菜单而不是在下面。来自 flexbox 的垂直填充失败。
https://jsfiddle.net/frrvdq2n/2/
那么有没有人对如何解决这个问题有一些建议,或者可能有其他提示来创建这个想法。提前谢谢:)
IMG. of how om thinking the sizing should be on most browser sizes.
这里也是代码,只是以防万一:
HTML
<!--<div class="container"> uncomment to see colapse-->
<div class="wrapper">
<div class="row3">Option One</div>
<div class="row3">Option Two</div>
<div class="row3">Option Three</div>
</div>
<!--</div>uncomment to see colapse-->
CSS
.wrapper, html, body {
height:100%;
margin:0;
}
.wrapper {
display: flex;
flex-direction: column;
}
.row3 {
background-color: green;
flex:2;
display: flex;
}
【问题讨论】: