我有一个类似于这样的页面结构:
<body>
<div id="parent">
<div id="childRightCol">
/*Content*/
</div>
<div id="childLeftCol">
/*Content*/
</div>
</div>
</body>
I would like for the parent div
to expand in height
when the inner div
’s height
increases.
编辑:
一个问题是,如果子内容的 width
width
扩展到浏览器窗口的 --- 之后,我当前的 CSS 会在父内容上放置一个水平滚动条 div
我希望滚动条处于页面级别。目前我的父 div 设置为 overflow: auto;
你能帮我处理这个 CSS 吗?
原文由 Steve Horn 发布,翻译遵循 CC BY-SA 4.0 许可协议
为父母尝试这个,它对我有用。
更新:
另一种有效的解决方案:
父母:
孩子: