2013-09-11 18 views
0

有在我的網站,該網站的內容少一些網頁,如何在頁面底部製作頁腳?

the content height + footer height < one screen height 

見下圖:

​​

所以我的問題是如何讓頁腳處的底部當我的內容的高度不足以覆蓋整個頁面時,哪些頁面?

PS:我不想將頁腳頁面固定在底部。

+0

向我們展示你的CSS的頁腳元素 –

+2

如果您不希望您的頁腳被修復,然後將最小高度應用到您的內容中 –

+0

@ C-Link能否解釋它更詳細LED? – Charles0429

回答

0

http://jsfiddle.net/yvZaV/1/

<div class="wrapper"> 
    <div>content here, this will push the footer down the page if it is needed</div> 
    <footer>footer here</footer> 
</div> 

html, body { 
    height:100%; 
    min-height:100%; 
} 
.wrapper { 
    position:relative; 
    min-height:100%; 
} 
footer { 
    position:absolute; 
    bottom:0px; 
    width:100%; 
    background-color:red; 
} 
+0

作者確實提到他不想將頁腳固定到頁面底部。 – BigMacAttack

+0

當內容推下去時它被推下去 – Anton

+0

我認爲絕對定位可能會導致其他問題... – andi

0

您可以設置min-height到你的內容,你可以將其設置在像素或%

.content{ 
    min-height: 100%; 
} 

http://jsfiddle.net/yvZaV/2/

+0

http://css-tricks.com/snippets/css/cross-browser-min-height/ –