页脚底部的固定页脚
答
我会推荐使用Ryan Fait's sticky footer。它可以完成你想用纯CSS做的事情。
HTML:
<div class="wrapper">
Content Here
<div class="push"></div>
</div>
<div class="footer"></div>
CSS:
* {
margin: 0;
}
html, body {
height: 100%;
}
.wrapper {
min-height: 100%;
height: auto !important;
height: 100%;
margin: 0 auto -142px; /* the bottom margin is the negative value of the footer's height */
}
.footer, .push {
height: 142px; /* .push must be the same height as .footer */
}
.footer { /* centers the text */
text-align: center; /* horizontal centering */
line-height: 142px; /* vertical centering; should be equal to the footer height */
}
答
尝试改变页脚元素,像这样的前述hr元素:
<footer style="position:fixed; left:0px; right:0px; bottom:0px;
background:rgb(255,255,255); text-align:center;">
<hr>
<p>© Company 2012</p>
</footer>
我认为这或多或少解决您的问题。它不像http://ryanfait.com/sticky-footer/的页脚那样工作,但据我了解你的问题,这是你想要的。
PS:CSS当然应该放在CSS文件中。
检查此页面右侧的“相关”链接。 – showdev 2013-02-08 22:35:11
您尝试过哪些教程,遇到了哪些问题? – zakangelle 2013-02-08 22:37:25
所有的教程都告诉你将html和body设置为100%。这样做会把所有的内容都向上放到整个页面上。 – Feriscool 2013-02-08 22:38:21