html - 粘性页脚和内容滚动 WP

标签 html css overflow footer sticky-footer

我们在 http://cmagics.eu/digitalmagazinepublishing 有一个 Wordpress 站点它使用 responsive2 主题。我们正在尝试获得一个看起来工作正常的粘性页眉,但是我们也试图获得一个粘性页脚,它只是粘在页面底部并且像 http://ryanfait.com/sticky-footer/ 中的那样工作。

由于 responsive2 主题有点神秘,我怎么能这样;

1。使用正确的粘性方法而不是 position:fixed 将页脚固定在页面底部

2。当页面上有足够的空间时,停止主要内容的不必要滚动?

html 来源:

查看源代码:http://cmagics.eu/digitalmagazinepublishing/

CSS

#footer {
    position: relative;
    clear:both;
    font-size: 11px;
    line-height: 1.5em;
    background: rgb(54, 53, 53);
    color: #fff;
    border-top: 2px solid #444;
    text-align:center;
    margin-top: -324px; **just a hack to make the footer appear at the bottom incorrectly**
    margin-bottom: -25px;
    height: 162px;
    font-family: Roboto Regular;
}

#site-container {
    width: 900px;
    margin: 130px auto 0 auto;
    overflow:auto;
    padding-bottom:162px;

}

.hfeed {
min-height:100%;
    height:100%;
    height: auto;

}

最佳答案

Here's a solution that I think is very clean .对所有主要内容元素(页眉、文章、页脚)使用绝对定位。如果您需要针对不同的屏幕宽度(响应式设计)更改页眉或页脚高度,请使用 @media 查询在不同的分辨率下创建中断,并告诉您的主要内容区域 overflow hidden 。您也可以通过这种方式在主要内容区域内使用 float 的相对布局。

关于html - 粘性页脚和内容滚动 WP,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14598329/

相关文章:

javascript - Flash 对象在重新设计其容器样式时重新启动或消失

css - 文本渐变和不同长度文本的问题

html - 显示单个文本字符串结尾的 CSS 样式

php - 用html渲染分页符

jquery - IE 10 和 11 中的灰度?

javascript - ng-click 父级通过子级点击

由于另一个干扰函数,Javascript 函数无法正常工作

javascript - 调整 <tr> 大小时无法让溢出工作

python - 使用 Flask 无法加载 CSS

html - 在 RESTful html 应用程序中将表单/替代 View 放在哪里?