我有一个固定宽度的左侧div,我想让右侧div填充剩余空间。CSS:在右侧填充剩余空间,没有内容溢出
到目前为止,我一直在taking this approach recommended by another SO poster,但它不工作,如果我有正确的div内的内容。
右侧div的内容设置为width: 100%
,所以我认为它不会比右侧div宽,但会溢出右侧div。
<div>
<div id="left">left</div>
<div id="right">right<div id="insideright">overflows</div</div>
</div>
<style>
#left {
float:left;
width:180px;
background-color:#ff0000;
}
#right {
width: 100%;
background-color:#00FF00;
}
#insideright {
width: 100%;
background-color: blue;
height: 5px;
}
</style>
的jsfiddle这里,demoing问题:http://jsfiddle.net/MHeqG/155/
我能做些什么?
我想支持较旧的IE浏览器,所以我宁愿不使用display: table-cell
等,如果我可以避免它,或者至少不是没有合理的回退。
你可以通过引用股利(或多个)你的实际ID澄清你的问题谈论? “正确的div中的内容......”哪个版权? – brandonscript
请定义“旧浏览器” –
其溢出,因为您将其宽度属性设置为浮动元素旁边的屏幕的100%。它一路继续,因为没有元素可以阻止它。你应该在漂浮物 – agconti