粘性页脚只能在一页上工作

时间:2017-03-30 02:49:14

标签: css sticky-footer

Page是here

我正在使用粘性页脚,除了我的投资组合页面以外,它可以正常运行。画廊相对定位,并从它的父div溢出。页脚粘贴到父页面的底部,而不是页面。

帮助?最好不要重写我的所有代码?

2 个答案:

答案 0 :(得分:3)

请尝试这个,希望它对您有所帮助。

html, body {
    height: 100%;
}
header {
    background: #fff;
    position: relative;
    z-index: 100;
}
.content2 {
    clear: both;
    margin: 0 auto;
    padding: 0;
    text-align: center;
    width: 70%;
}
.gallery {
    display: table;
    height: 100%;
    margin-left: auto;
    margin-right: auto;
    margin-top: auto;
    position: relative;
    width: 100%;
}
#footer-block {
    bottom: 0;
    position: fixed;
    width: 100%;
}

由于

答案 1 :(得分:0)

通过将body和html编码为110%高度,将页脚包装为100%高度,并添加100%高度的页面包装来修复它。

相关问题