【发布时间】:2015-06-20 03:43:36
【问题描述】:
好的,当没有足够的内容自然地将页脚推到底部时,我无法将页脚强制放在底部。
我部分解决了问题。这是一个非常简单的设计,我有页眉、内容和页脚,都在 div 包装器中。
html,
body {
margin:0;
padding:0;
height:100%;
font: sans-serif;
}
#wrapper {
min-height:100%;
position:relative;
}
#content {
padding: 2% 5%;
max-width: 940px;
margin: 0 auto;
padding-bottom:80px; /* Height of the footer element */
clear: both;
background-color: yellow;
}
footer {
background:#ffab62;
width:100%;
height:80px;
position:absolute;
bottom:0;
left:0;
font-size: 0.75em;
text-align: center;
padding-top: 30px;
clear: both;
color: #ccc;
}
我使用背景颜色来查看页面上元素的位置。因此,当底部没有足够的内容页脚时,就可以了。当有足够多的内容页脚与其中一些重叠时,当我将位置放在页脚相对而不是绝对页脚上时,它会得到修复,但然后在没有足够内容页脚的页面上没有底部.. 修复另一个不好并修复其他第一页不好..有什么解决方案可以帮助我解决这个问题...
【问题讨论】:
-
能不能看demo或者有html代码?
-
这是一个经典问题;有几种不同的场景,更多代码/完整代码或在线演示会有所帮助!