我不太擅长 CSS,但希望这里有人可以提供帮助。我有以下样机。(我已经剥离了我的内容以便于查看)
<body>
<div id="container">
<div id="header"></div>
<div id="body">
<div id="navBar"></div>
<div id="mainContent"></div>
</div>
<div id="footer"></div>
</div>
</body>
我的CSS如下:
html,
body {
margin:0;
padding:0;
height:100%;
}
#container {
min-height:100%;
position:relative;
}
#header {
background:#ff0;
padding:10px;
}
#body {
padding:10px;
padding-bottom:60px; /* Height of the footer */
}
#footer {
position:absolute;
bottom:0;
width:100%;
height:60px; /* Height of the footer */
background:#6cf;
}
现在我不确定如何让“navBar”成为页面高度。我试过添加 height: 100% 但这不起作用。
谢谢,马特