我有一个流畅的布局,但结果是,当页面中没有足够的内容时,我的页脚会像在this example中一样向上移动。

将页脚保留在页面底部的一个流行的解决方案是使用position: fixed或position: absolute,然而,当我这样做时,内容可能会在调整大小时与页脚发生冲突(你可以看到我所说的here。尝试将窗口大小调整到文本隐藏在页脚后面的位置)。

那么,如何才能在页面底部设置页脚,并在流畅的布局中与页面的其余部分一起移动呢?
谢谢!
发布于 2012-03-10 13:25:47
我可能会做这样的事...再加上一点jQuery。
var a = $('#floatdiv').height(); //get the height of the content
var b = $(window).height(); //get the height of the window
var c = $('footer').height(); //get the height of the footer
var d = b - c; //subtract the footer height from window height
if(a < b){ //if the content is smaller than the window
$('#floatdiv').css('height', d + 'px'); //set the content height to the
} //window minus the footer示例: http://jsfiddle.net/tM445/6/
https://stackoverflow.com/questions/9642460
复制相似问题