2012-10-10 41 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