我有一个#main
div,当没有内容时,我想让它填满页眉和页脚之间的页面。当有内容时,它应该将粘性页脚向下推,它确实做到了。
CSS:
#main {
background: transparent url("images/main-content.png") top right repeat-y;
clear: both;
overflow: hidden;
margin-top: -10px;
height: 100%;
min-height: 100%;
}
我不确定为什么这个不起作用。
#main
继承自 #wrapper
和 body
,因此我认为设置100%的高度和最小高度应该可以工作。网站: http://www.dentistrywithsmiles.com 非常感谢您提前帮助。
#wrapper
底部添加padding,它只会将我的页脚向下推,而我希望它保持粘性。 - blackessejdiv
需要占据填满页面的高度,并且不允许页脚爬到页面高度之上,为什么要使用固定页脚?您只需为该div指定最小高度即可,因为它已经将页脚div
向下推。只是在思考... - Blender