这是问题所在:我想在同一行中有 2 个浮动 div。右 div 可以是固定宽度。左 div 应该占用所有剩余空间,并将文本包装在里面。父容器宽度是可变的,所以我不能在两个 div 上设置宽度。
div{border: 1px solid black}
.left{float: left}
.right{float: right}
<div class="left">
very long text very long text very long text very long text very long text very long text very long text very long text very long text very long text very long text
</div>
<div class="right">
short text
</div>