我正在尝试创建一个布局,其中包含页眉和页脚(两者都有固定的高度)以及它们之间的内容 div,用于填充剩余空间。在 content-div 中,我希望 div 的高度基于百分比值(以 content-div 的 heihgt 作为父级)。我不知道该怎么做?
最佳答案
[ See it in action ]
#header {
position:absolute;
height: 50px;
left:0;
top:0;
width:100%;
background:green;
}
#footer {
position:absolute;
height: 50px;
left:0;
bottom:0;
width:100%;
background:green;
}
#content {
position: absolute;
top:50px;
bottom:50px;
left:0;
width:100%;
background:#eee;
}
#box1 {
height:50%;
width:30%;
float:left;
background:red;
}
关于css - 带有页眉和页脚的 100% Css 布局,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3186123/