首先,我进行了很多搜索,所有答案都建议将html和body height设置为100%,所以我这样做了,但是没有用。
问题是,主体背景为灰色(#e5e5e5),其中右侧栏可能会更改其背景颜色(#fff或其他任何颜色)
示例:http://jsfiddle.net/Lzm0mf9d/
在我的设计中:
html {
height: 100%;
}
body {
height: 100%;
background-color: #e5e5e5;
}
.container {
height: 100%;
}
.left {
width: 300px;
position: fixed;
top: 0px;
left: 0px;
height: 100%;
}
.right {
position: absolute;
top: 0px;
left: 300px;
background-color: #FFF;
width: calc(100% - 300px);
height: 100%;
}
问题是,右侧背景与视口一样高。无论内容多长。
<div class="container"><div class="left"></div><div class="right"></div></div>
或移除.right中的高度:100%。您想达到什么目的?
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句