【发布时间】:2012-12-21 12:10:39
【问题描述】:
我有一个两列的流动布局,左侧设置为width: 40%,右侧隐藏设置为width: 60%。我希望允许用户根据自己的喜好调整浏览器的大小,但我必须让左侧显示最小宽度为300px。
以下是我目前用于流体布局的代码,其中包括min-width 规范。但是,CSS 忽略了它!它允许左侧列缩小到300px 以下。
我还尝试将min-width 设置为百分比,例如20%,但CSS 也会忽略此规范。
div#left {
background: #ccc;
position: fixed;
top: 0;
bottom: 0;
left: 0;
width: 40%;
min-width:300px;
height: 100%;
}
div#right {
background: #aaa;
position: fixed;
top: 0;
width:60%;
right: 0;
bottom: 0;
}
jsFiddle 全屏示例: http://jsfiddle.net/umgvR/3/embedded/result/
jsFiddle 代码: http://jsfiddle.net/umgvR/3/
这是什么原因造成的?如何更正代码?
【问题讨论】:
-
当达到左侧的最小宽度时,右侧 div 会发生什么?
标签: css fluid-layout