2017-05-06 193 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