2017-05-06 125 views
0

即使在頁面中沒有足夠的內容時,如何將頁腳固定到屏幕底部? 我的意思是,當頁面是空的頁腳跳起來走半個屏幕的一半在Wordpress中將頁腳固定到頁面的底部

我試圖將內容設置高度爲100%,屏幕的大小,頭&頁腳的高度更低,有以下幾點:

#main { 
min-height: calc(100% - 80px - 70px); 
} 

但100%等於0像素由於內容(嵌套在#main內)爲空

如何採取100%的呢?

我問在wordpress.org相同的,他們指示我因此,對於這個類型的問題

編號: https://wordpress.org/support/topic/fix-footer-to-the-bottom-of-screen/

Image

+0

鏈接? –

+0

http://www.sun-tex.co.il/test2/ – idan

回答

0

將css應用到頁腳:

.footer-wrapper{ 
    position: absolute; 
    right: 0; 
    bottom: 0; 
    left: 0; 
} 

對於包裝,現場的

#wrapper, #main{ 
position: static !important; 
} 
+0

中途,腳註現在固定在底部,但它的包裝/背景仍然填滿了屏幕:https://s2.postimg.org /a7jgxthxl/Untitled.png我認爲這是需要調整的#main內容高度 – idan

+0

刪除位置:相對;從標題。 –

+0

工作很好,只是頭影消失了,我該如何解決? https://s22.postimg.org/5c1d50x8x/Untitled.png – idan

0

我不知道,但你可以試試這個,讓我知道它是否有效

.footer{ 
top: 100vh; 
transform: translate(-100%,0); 
position:fixed; 
} 
+0

'#main { top:100vh; transform:translate(-100%,0); 職位:固定; }'result:https://image.ibb.co/hnrPvk/Untitled.png – idan

+0

'#footer {top:100vh; transform:translate(-100%,0);位置是:固定; }'結果:https://image.ibb.co/djthgQ/Untitled2.png – idan