重叠为了使问题更容易分析我已经创建this jsFiddle:页眉和页脚的div中的内容
代码:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style>
body {margin:0; }
#mainContainer { position: absolute; right: 4%; left: 4%; height: 100%; }
#headerContainer { width: 100%; z-index: 10; position: absolute; background: #323232; color: white; height: 30px; }
#middleContainer { height: 100%; }
#leftSection { position: absolute; float: left; width: 175px; background: #71ABD1; height: 100%; overflow: auto; color: black; padding-top: 30px; }
#middleSection { position: absolute; height: 100%; background-color: yellow; left: 175px; right: 175px; color: black; padding-top: 30px; }
#rightSection { float: right; height: 100%; width: 175px; border-left: 1px dotted black; background: red; color: black; padding-top: 30px; }
#footerContainer { position: absolute; bottom: 0; width: 100%; height: 30px; background: #323232; color: white; }
</style>
</head>
<body>
<div id="mainContainer">
<div id="headerContainer">
headerContainer
</div>
<div id="middleContainer">
<div id="leftSection">
leftSection
</div>
<div id="middleSection">
middleSection
</div>
<div id="rightSection">
rightSection
</div>
</div>
<div id="footerContainer">
footerContainer
</div>
</div>
</body>
</html>
随着顶部,中部和底部的标记,问题是:
1 - 正如你所看到涂成黑色页脚是不是真的在页面的底部,尽管在页脚DIV有position:absolute
和bottom:0px
2-更重要的是,leftSection,middleSection和rightSection DIV与页眉和页脚DIV重叠,实际上,在这个小提琴中,看到显示的3个中间部分的文本的唯一方法是放置填充以避免出现填充显示在标题DIV下面。
我已经尝试在middleContainer上放置30px的顶部和底部值来解决重叠问题,但这并不能解决问题,我只想将headerContainer保留在底部,footerContainer保留底部,而所有3个中间部分都会调整到100%的高度。左边部分和右边部分具有固定宽度,但中间部分具有柔性宽度和高度。
的'填充顶:30PX;'是什么推你列下来过去页脚 – robbieAreBest