我有以下代码
<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/