html - 应用最小高度时,容器 div 内的 div 消失
问题描述
我有三个 100% 高度的 div,我想在它们周围添加一个高度是自动的容器,所以如果我添加另一个第四个 div,容器的高度会扩大。但是,当我将 height: auto 添加到容器 div 时,三个 div 消失了。我也尝试过 min-height: 100% ,但这没有用。我找不到适合我并帮助我了解情况的答案。提前致谢。
html,body {
height: 100%;
margin: 0;
}
html>body .content {
height: auto;
}
.container {
height: auto;
}
.content {
height: 100%;
min-height: 100%;
}
#one {
background-color: pink;
}
#two {
background-color: lightblue;
}
#three {
background-color: lightgreen;
}
<div class="container">
<div class='content' id='one'></div>
<div class='content' id='two'></div>
<div class='content' id='three'></div>
</div>
解决方案
推荐阅读
- angular - mat-autocomplete 使用 ngx-perfect-scrollbar 错误
- javascript - 如何向 JSFiddle 添加外部图像?
- reactjs - 为什么 Material-UI Select 不显示任何选项?
- javascript - 如何在nodejs中每天过去时获取日期?
- javascript - 使用 JavaScript 为行和列选择第 n 个子元素后,未创建输入元素
- td-engine - 在 TDengine 数据库中批量插入期间更新不起作用
- hadoop - HIVE - 我如何转换时间戳和总和值
- javascript - 如何在 React 状态下动态更新对象键
- postgresql - 与postgresql中的过滤器功能合并
- android-softkeyboard - 使用提交内容 APi 的三星键盘问题