【发布时间】:2013-09-02 14:16:57
【问题描述】:
我的页脚不想粘在页面底部。我是 HTML 新手,我不能让它下去。
这是我的代码:
<div class="footer">
Copyright © 2013. All rights reserved
</div>
【问题讨论】:
-
页脚类中有什么 CSS?
标签: css sticky-footer
我的页脚不想粘在页面底部。我是 HTML 新手,我不能让它下去。
这是我的代码:
<div class="footer">
Copyright © 2013. All rights reserved
</div>
【问题讨论】:
标签: css sticky-footer
简单的固定解决方案:
.footer {
position: fixed;
bottom: 0;
}
简单的绝对解决方案:
.footer {
position: absolute;
bottom: 0;
}
Fancier Sticky Footer:
html {
position: relative;
min-height: 100%;
}
body {
margin: 0 0 100px; /* bottom = footer height */
}
.footer {
position: absolute;
left: 0;
bottom: 0;
height: 100px;
width: 100%;
background: red;
}
【讨论】:
StackOverflow 上有几个这样的问题,一个这样的问题是下面...
How to align footer (div) to the bottom of the page?
...和I've given an answer to that question。
如果您不想找到答案,这里有两个快速链接:
如果这不是您所要求的,或者您在实施方面需要帮助,请告诉我!我希望这会有所帮助。
【讨论】: