试图做一个带有header,body和footer的柱状柔性盒,然后在体内有两个并排的尊重柔性盒边界的div(即don不会溢出页脚)。flex-flow column with side-by-side divs in body
html,
body {
height: 100%;
margin: 0;
}
.app {
display: flex;
flex-flow: column;
height: 100%;
}
.header {
flex: 0 1 auto;
border-style: solid;
border-width: 1px;
border-color: blue;
}
.body {
display: flex;
flex-flow: column;
flex: 1 1 auto;
overflow-y: auto;
border-style: solid;
border-width: 1px;
border-color: red;
}
.footer {
flex: 0 1 40px;
border-style: solid;
border-width: 1px;
border-color: green;
}
.inner {
position: absolute;
}
.left {
float: left;
width: 200px;
height: 100%;
}
.right {
margin-left: 225px;
height: 100%;
}
简单的测试案例中的jsfiddle
<div class='app'>
<div class='header'>
<p><b>header</b>
<br />
<br />(sized to content)</p>
</div>
<div class='body'>
<div class='inner'>
<div class='left'>
<p>test 1</p>
<p>test 1</p>
<p>test 1</p>
<p>test 1</p>
<p>test 1</p>
<p>test 1</p>
<p>test 1</p>
<p>test 1</p>
<p>test 1</p>
<p>test 1</p>
<p>test 1</p>
<p>test 1</p>
<p>test 1</p>
<p>test 1</p>
<p>test 1</p>
<p>test 1</p>
</div>
<div class='right'>
<p>test 2</p>
<p>test 2</p>
<p>test 2</p>
<p>test 2</p>
<p>test 2</p>
<p>test 2</p>
<p>test 2</p>
<p>test 2</p>
<p>test 2</p>
<p>test 2</p>
<p>test 2</p>
</div>
</div>
</div>
<div class='footer'>
<p><b>footer</b> (fixed height)</p>
</div>
</div>
https://jsfiddle.net/XJ45G19/9e7vjykv/
任何想法,我要去哪里错了吗?提前致谢!
不确定你确切的问题是什么,但是当你从'.inner'中删除'position:absolute'时出了什么问题? –
arg!谢谢乔。我觉得很愚蠢。如果你想发布这个答案,我会很乐意接受它。并再次感谢您的帮助。 – shaz
哈哈,没问题。 –