编辑:小提琴
我已经准备好
html{
height: 100%;
}
和
body{
min-height: 108%;
}
我想将content
显示为footer
的完全高度,即使content
是空的。
我是container
这是content
发布于 2014-05-22 07:50:23
除了在height:100%
元素中添加min-height:108%
之外,还可以通过添加min-height:108%
来修复这个问题:
http://jsfiddle.net/C8UUt/1/
body {
font: 100%/1.4 Verdana, Arial, Helvetica, sans-serif;
background: #42413C;
margin: 0;
padding: 0;
color: #000;
min-height: 108%;
height: 100%;
}
更新
要使sidebar1
达到完全高度,可以使用一个小技巧:
http://jsfiddle.net/C8UUt/3/
.container {
width: 960px;
background: #FFF;
margin: 0 auto;
min-height: 100%;
position: relative; // added this to tell position:absolute that this is his parent
}
.sidebar1 {
float: left;
width: 180px;
background: #EADCAE;
padding-bottom: 10px;
display: inline-block;
height: 100%; // to make it 100% height
position: absolute; // added this so it will take `min-height` of parent into account
}
.content {
padding: 10px 0;
width: 780px;
display: inline-block;
/* float: left; */
height: inherit;
margin-left: 180px; // since position:absolute doesn't take part in the normal flow, we must account for that space manually
}
发布于 2014-05-22 07:48:44
如果您的浏览器支持CSS3,请使用以下内容:
.container {height:100vh;}
https://stackoverflow.com/questions/23800481
复制相似问题