gpt4 book ai didi

html - 使 div 占用剩余宽度

转载 作者:行者123 更新时间:2023-11-28 04:32:30 25 4
gpt4 key购买 nike

我有以下代码

<div style="float:left;height:16px; background:grey; width:200px;"></div>
<div style="float:left;height:16px; background:lightblue; width:100px;"></div>

是否可以在不使用表格的情况下让第二个 div 占据所有剩余宽度?

这里是 JSFiddle 澄清 http://jsfiddle.net/xtkoycyv/

最佳答案

是的,它是...从第二个 div 中删除 float

<div style="float:left;height:16px; background:grey; width:200px;">this text</div>
<div style="height:16px; background:lightblue;">that text</div>

关于html - 使 div 占用剩余宽度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29984660/

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