如果页面内容不多,如 300 像素左右,页脚将出现在页面中间,分辨率为 1024。
在不知道页脚高度的情况下,如何让页脚显示在页面底部?
我试过这个解决方案:
/* css */
html, body {
height: 100%;
}
#container {
min-height: 100%;
position: relative;
}
#footer {
position: absolute;
bottom: 0;
}
<!-- html -->
<html>
<head></head>
<body>
<div id="container">
<div id="footer"></div>
</div>
</body>
</html>
但问题是我需要padding-bottom: (footerheight);
在#footer 之前添加元素。这是不可能的,因为页脚高度因页面而异...