1

当没有足够的内容时,我的页脚不会粘在页面底部,例如,当有人搜索没有结果时,页脚会显示在屏幕中间而不是停留在底部页。

我已经阅读了所有其他帖子,但似乎代码与我的不同。

这是页脚 CSS 代码:

    .footer {
    padding: 10px 0;
     }

      #footercontainer {
    clear:both; 
    width:100%; 
    position:relative; 
    height:250px;
    bottom:0;

    }
#footer {
    clear:both; 
    padding-top:0px; 
    width:100%; 
    position:absolute; 
    bottom:0;
    left:0;
}

#footer img {
    border:none; 
    text-align:center;
}

#footermiddlecontent {
    width:973px;
     margin-left:auto; 
     margin-right:auto;

     }
#footermiddlecontent p {
    font-size:14px;

    }
#footermiddlecontent a {
    font-size:12px; 
    font-family:arial;

    }
#footerbottom p {
    text-align:center; 
    padding-top:5px; 
    font-size:12px; 
    font-family:arial;

    }
#footerbottom a {
    font-family:arial;

    }
4

3 回答 3

1

看起来您需要使用CSS Sticky Footer

于 2012-09-23T17:07:26.330 回答
0

您是否尝试过使用 position:fixed

于 2012-09-17T21:31:59.883 回答
0

您需要将 html、body 和任何其他父元素设置为 100% 高度。如果您可以发布构成页面的其余 HTML 和 CSS,我可以尝试为您提供更多帮助。

于 2015-01-21T14:52:50.150 回答