gpt4 book ai didi

html - 将父
扩展到其子元素的高度

转载 作者:IT老高 更新时间:2023-10-28 11:01:59 25 4
gpt4 key购买 nike

我有一个类似这样的页面结构:

<body>
<div id="parent">
<div id="childRightCol">
/*Content*/
</div>
<div id="childLeftCol">
/*Content*/
</div>
</div>
</body>

当内部 divheight 增加时,我希望父 divheight 中展开.

编辑:
一个问题是,如果子内容的 width 扩展超过浏览器窗口的 width,我当前的 CSS 会在父 div 。我希望滚动条位于页面级别。目前我的父 div 设置为 overflow: auto;

你能帮我解决这个问题吗?

最佳答案

为 parent 试试这个,它对我有用。

overflow:auto; 

更新:

另一个有效的解决方案:

家长:

display: table;

child :

display: table-row;

关于html - 将父 <div> 扩展到其子元素的高度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/384145/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com