2012-10-10 38 views
2

我有一个很难与此有关。这是我的代码:整合停靠页脚

http://jsfiddle.net/HMsKa/30/

我试图整合的时候有内容很少量的停靠页脚。我使用这个网站如何做到这一点的代码示例:

http://ryanfait.com/sticky-footer/
http://ryanfait.com/sticky-footer/layout.css

但是,不管是什么内涵,我把这个代码到我的网站,这是行不通的。有人能告诉我,我应该如何将这与我现有的代码整合?

回答

0

你必须检查你的HTML结构,看在贴纸英尺的HTML为例。

它必须是如下有点:

HTML:

<body> 
    <div class="wrapper"> 
     <!-- your content --> 
     <div class="push"></div> 
    </div> 
    <div class="footer"></div> 
</body> 

由于CSS文件说,在这里我要重建它:

* { 
    margin: 0; 
} 
html, body { 
    height: 100%; 
} 
.wrapper { 
    min-height: 100%; 
    height: auto !important; 
    height: 100%; 
    margin: 0 auto -142px; /* the bottom margin is the negative value of the footer's height */ 
} 
.footer, .push { 
    height: 142px; /* .push must be the same height as .footer */ 
} 

/* 

Sticky Footer by Ryan Fait 
http://ryanfait.com/ 

*/ 

的有些编辑您的小提琴: http://jsfiddle.net/HMsKa/36/

您需要一个.wrappermin-height: 100%

+0

谢谢你的回复。不幸的是,它不是很正常。当你拖动窗口了犯规留在页面底部的页脚,你可以看到其下的空白! :( –

+0

@JamesWillson对不起一个错字,在''这应该是','这里是固定一个http://jsfiddle.net/HMsKa/36/,我在前面已经更新。 – VKen