我有以下 html 和 css:
HTML:
<body style="height:100%;">
<div class="fb-container">
<div class"somedatadiv">
Some data
</div>
<div class="anotherdiv">
data
</div>
</div>
</body>
CSS:
.fb-container {
display: flex;
flex-wrap: no-wrap;
align-items: stretch;
// min-height: 100%;
}
.somedatadiv {
width: 75%;
max-width: 345px;
backround: grey;
padding: 30px;
}
由于某种原因,弹性容器 div 没有拉伸 100% 的主体高度。
(我使用的浏览器是这个“演示/应用程序/站点”的 chrome)
原文由 Babulaas 发布,翻译遵循 CC BY-SA 4.0 许可协议
您需要将
display:flex
添加到父标签,然后将flex:1
添加到子标签,以使子标签能够扩展到父标签的 100%。