2012-09-17 100 views
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; 

    } 
+0

请尝试http://stackoverflow.com/questions/7956787/footer-wont-stick-to-the-bottom-help 也http://stackoverflow.com/questions/1488565/how-tostick -a-footer-to-bottom-in-css 我建议在大多数情况下避免使用javascript。请发布代码的骨架以获得更全面的答案。 – kush

回答

0

你尝试使用 位置:固定

+0

固定位置会将页脚固定到屏幕底部,而不是我正在查找的结果。我正在寻找页脚始终处于页面底部,有或没有内容,而不是屏幕。 – user1678673

0

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