我想使用flexboxes制作完整高度的页面,其中的内容也使用flexbox。该页面应如下所示example of what it should look like。蓝色div是动态的,可以改变高度,红色内容应占用内容div的剩余空间。这适用于Firefox和IE,但是在Chrome上它会溢出。有人可以解释为什么它在Chrome上溢出?Chrome flexbox其他100%高度flexbox溢出100%高度
的HTML如下:
<body>
<div class="container">
<div class="navbar">Navbar</div>
<div class="content">
<div class="container">
<div class="fill"></div>
<div class="dynamic">Here is some dynamic content<br>Test</div>
</div>
</div>
</div>
</body>
而CSS是:
body{
margin:0;
}
.container{
display: flex;
flex-direction: column;
width: 100%;
height: 100%;
}
.navbar{
background-color: #ccc;
flex: none;
}
.content{
background-color: #333;
flex: auto;
padding: 10px;
}
.dynamic{
background-color: #0066ff;
flex: none;
}
.fill{
flex: auto;
background-color: #ff0000;
}
添加'箱尺寸:边界盒;''到.content' – SeinopSys