我在浏览器底部定位页脚时遇到了经典问题。我已经尝试过包括http://ryanfait.com/resources/footer-stick-to-bottom-of-page/在内的方法,但效果不佳:我的页脚总是出现在 FF 和浏览器窗口的中间IE。
在 HTML 中,我得到了这个简单的结构
<form>
...
<div class=Main />
<div id=Footer />
</form>
这是与 css 页脚问题相关的 css 代码:
*
{
margin: 0;
}
html, body
{
height: 100%;
}
#Footer
{
background-color: #004669;
font-family: Tahoma, Arial;
font-size: 0.7em;
color: White;
position: relative;
height: 4em;
}
.Main
{
position:relative;
min-height:100%;
height:auto !important;
height:100%;
/*top: 50px;*/
margin: 0 25% -4em 25%;
font-family: Verdana, Arial, Tahoma, Times New Roman;
font-size: 0.8em;
word-spacing: 1px;
line-height: 170%;
/*padding-bottom: 40px;*/
}
我在哪里做错了?我真的什么都试过了。如果我错过了任何有用的信息,请告诉我。
感谢您提前提出任何建议。
问候,
谢谢大家的答案。它适用于:
position:absolute;
width:100%;
bottom:0px;
设置位置:由于某种原因,固定在 IE 中不起作用(仍然在浏览器中间显示页脚),仅适用于 FF。