【发布时间】:2016-02-02 11:13:17
【问题描述】:
在一个左右填充 2% 的容器中,我有两个 div 框。左边的 div 框有 200px 的固定宽度和 60px 的固定边距。我希望正确的 div 调整其宽度,浏览器窗口越小/越大。如何实现红色框的宽度始终(与浏览器宽度无关)填充到容器的右填充开始,而蓝色 div 保持其 200 像素?
JSFIDDLE:http://jsfiddle.net/3vhrst19/3/
HTML:
<div id="container">
<div id="fixed-width"></div>
<div id="flexible-width"></div>
</div>
CSS:
#container {
float: left;
width: 100%;
padding: 50px;
background: lightgrey;
}
#fixed-width {
float: left;
width: 200px;
height: 500px;
margin-right: 60px;
background: blue;
}
#flexible-width {
float: left;
width: 500px; /* my goal is that the width always fills up independent of browser width */
height: 500px;
background: red;
}
【问题讨论】:
标签: html css responsive-design