【问题标题】:Using sticky footer, can't get the background of main content to stretch to footer使用粘性页脚,无法将主要内容的背景拉伸到页脚
【发布时间】:2013-03-25 08:14:07
【问题描述】:

我读过一篇非常相似的帖子并尝试了所有解决方案,但没有任何乐趣。这就是我所拥有的。我的网站具有全宽(100%)页眉和页脚空间以及一个较小宽度的容器。我使用了 Ryan Fait 粘性页脚,但容器(具有白色背景)不会到达页脚,除非我只是放入一堆换行符,这违背了粘性页脚的目的。

样式:

html, body {
height: 100%;}

body    {
margin:0;
padding:0;
}

html {
overflow: -moz-scrollbars-vertical; 
overflow-y: scroll;}

.wrapper {
min-height: 100%;
height: auto !important;
height: 100%;
margin: 0 auto -30px;}

.container {
width:1050px;
margin: 0 auto 0 auto;
min-height: 100%;
height: auto !important;
height: 100%;
padding:0 25px 0 25px;
background-color:#FFF;
    }

 .footer, .push {
height: 30px;}

 .footer {
background-color:#000;
width:100%;
height: 30px;}

还有html:

<div class="wrapper">
<div class="container">
/* content */
</div>
<!--end container-->
<div class="push"></div>
</div>
<!--end wrapper-->
<div class="footer">
/* footer */
</div>
<!--end footer-->

【问题讨论】:

    标签: css footer sticky


    【解决方案1】:

    您可以摆脱 .wrapper 并将 .push 移动到您的 .container

    见小提琴:http://jsfiddle.net/32WxJ/3/

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-01-15
      • 1970-01-01
      • 2013-06-28
      • 2012-08-20
      • 1970-01-01
      • 2016-10-03
      • 2013-02-23
      • 1970-01-01
      相关资源
      最近更新 更多