gpt4 book ai didi

html - 停止 float :left from stoping my div from occupying space in another div

转载 作者:太空宇宙 更新时间:2023-11-03 20:51:53 25 4
gpt4 key购买 nike

我如何设置“a”的样式,使其占据空间并同时向左浮动?

<div style="background:#111">
<div id="a" style="float:left; height:30px"></div>
</div>

最佳答案

在父级上使用overflow 样式,而不指定父级的大小:

<div style="background:#111;overflow:hidden;">
<div id="a" style="float:left; height:30px"></div>
</div>

关于html - 停止 float :left from stoping my div from occupying space in another div,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14911063/

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