【发布时间】:2016-09-22 17:29:39
【问题描述】:
https://jsfiddle.net/vz7cLmxy/
我试图让身体扩张,但最小高度不起作用。我已阅读其他相关主题,但无法理解。
CSS 和 html
body,
html {
padding: 0;
margin: 0;
min-height: 100%;
}
body {
display: flex;
background: #eee;
flex-direction: column;
}
.menu {
background: red;
color: #fff;
padding: 10px;
}
.wrap {
display: flex;
}
.sidebar {
background: #ddd;
width: 300px;
}
.main {
background: #ccc;
flex: 1;
}
.footer {
background: #000;
color: #fff;
padding: 10px;
}
<div class="menu">Menu</div>
<div class="wrap">
<div class="sidebar">Sidebar</div>
<div class="main">Main</div>
</div>
<div class="footer">Footer</div>
预期结果是,如果 main 小于 100%,则会拉伸以填充高度。
【问题讨论】: