gpt4 book ai didi

html - 使用显示 : table? 时如何使内部 DIV 填充到外部 DIV 的高度

转载 作者:太空宇宙 更新时间:2023-11-03 19:34:07 24 4
gpt4 key购买 nike

我有以下 HTML,可以在这个 fiddle: 中看到

<div id="parent">
<div id="a" class="grid_6" style="background-color: #ff00ff">
<div class="block-border">
<div style="background-color: #123456">
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
</div>
</div>
</div>
<div id="b" class="grid_6" style="background-color: #ffff00">
<div class="block-border">
<div id="xx" style="background-color: red;">
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.
</div>
</div>
</div>
</div>

如何使 id="xx"的 DIV 扩展高度以填充包含的 DIV?

最佳答案

如果将 .grid_6 设置为 position: relative 并将 #xx 设置为 height: 100%; position: absolute; 它应该可以工作。虽然,这可能并不理想。

#parent {
display: table-row;
}

.grid_6 {
position: relative;
display: table-cell;
width: 50%;
}

#xx {
height: 100%;
position: absolute;
}

查看此 fiddle作为一个工作示例。

关于html - 使用显示 : table? 时如何使内部 DIV 填充到外部 DIV 的高度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14862869/

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