我使用jQuery将页脚定位在页面底部,但仍有一些空白显示
嗨,我用下面的代码试图把页脚放在我的网页底部,但仍然有一些空白显示,我无法找出是什么原因造成的。当我右键单击并转到inspect时,一旦开发人员工具打开,空白就会消失,并且页脚底部不会显示任何填充我使用jQuery将页脚定位在页面底部,但仍有一些空白显示,jquery,css,twitter-bootstrap,Jquery,Css,Twitter Bootstrap,嗨,我用下面的代码试图把页脚放在我的网页底部,但仍然有一些空白显示,我无法找出是什么原因造成的。当我右键单击并转到inspect时,一旦开发人员工具打开,空白就会消失,并且页脚底部不会显示任何填充 <script type="text/javascript"> $(window).bind("load", function () { var footer = $("#footer");
<script type="text/javascript">
$(window).bind("load", function () {
var footer = $("#footer");
var pos = footer.position();
var height = $(window).height();
height = height - pos.top;
height = height - footer.height();
if (height > 0) {
footer.css({
'margin-top': height + 'px'
});
}
});
</script>
$(窗口)。绑定(“加载”,函数(){
变量页脚=$(“#页脚”);
var pos=footer.position();
var height=$(window.height();
高度=高度-位置顶部;
高度=高度-页脚高度();
如果(高度>0){
footer.css({
“页边距顶部”:高度+“px”
});
}
});
这里是我的css文件的链接
你能分享你的html代码吗?不用jQuery,只需使用css:
#footer{position;absolute;bottom:0;}