Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/414.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 将页脚贴在页面底部_Javascript_Css_Html - Fatal编程技术网

Javascript 将页脚贴在页面底部

Javascript 将页脚贴在页面底部,javascript,css,html,Javascript,Css,Html,请在firefox中查看此网站: 页脚不会像stackoverflow的页脚那样粘在页面底部。我尝试了一些技术,如一些参考网站所示,但仍然没有成功 我需要一些css专家来帮我解决这个问题。谢谢大家! 添加位置:固定;底部:0;左:0到页脚,并将其固定到位。如果您随后添加#容器{padding bottom:120px}(或大约该数量的内容),则在查看页面底部时,页脚不会隐藏您的内容添加位置:固定;底部:0;左:0到页脚,并将其固定到位。如果您随后添加#容器{padding bottom:120

请在firefox中查看此网站:

页脚不会像stackoverflow的页脚那样粘在页面底部。我尝试了一些技术,如一些参考网站所示,但仍然没有成功


我需要一些css专家来帮我解决这个问题。谢谢大家!

添加
位置:固定;底部:0;左:0
到页脚,并将其固定到位。如果您随后添加
#容器{padding bottom:120px}
(或大约该数量的内容),则在查看页面底部时,页脚不会隐藏您的内容

添加
位置:固定;底部:0;左:0
到页脚,并将其固定到位。如果您随后添加
#容器{padding bottom:120px}
(或大约该数量的内容),则在查看页面底部时,页脚不会隐藏您的内容

使其固定在底部
0
值的位置:

footer {
    position: fixed; 
    bottom: 0;
}

使其固定在底部
0
值的位置:

footer {
    position: fixed; 
    bottom: 0;
}

有很多方法可以制作粘脚。固定高度的页脚的基本技巧

html, body {
    height: 100%;
}
.wrapper {
    min-height: 100%;
    height: auto !important;
    height: 100%;
    margin: 0 auto -150px; /* the bottom margin is the negative value of the footer's height */
}
.footer {
    height: 150px; /* .push must be the same height as .footer */
}


你可以用标题“sticky footer”(粘性页脚)来检查这一点(以及许多其他问题)

制作粘性页脚有很多方法。固定高度的页脚的基本技巧

html, body {
    height: 100%;
}
.wrapper {
    min-height: 100%;
    height: auto !important;
    height: 100%;
    margin: 0 auto -150px; /* the bottom margin is the negative value of the footer's height */
}
.footer {
    height: 150px; /* .push must be the same height as .footer */
}

您可以使用标题“sticky footer”(粘性页脚)来检查这一点(以及许多其他内容)


$(文档).ready(函数(){
var docHeight=$(window.height();
var footerHeight=$('#footer').height();
var footerTop=$('#footer').position().top+footerHeight;
如果(页脚顶部<八){
$('#footer').css('margin-top',10+(docHeight-footer)+'px');
}
});

$(文档).ready(函数(){
var docHeight=$(window.height();
var footerHeight=$('#footer').height();
var footerTop=$('#footer').position().top+footerHeight;
如果(页脚顶部<八){
$('#footer').css('margin-top',10+(docHeight-footer)+'px');
}
});