Html 如何使页脚粘在页面底部

Html 如何使页脚粘在页面底部,html,css,footer,Html,Css,Footer,我已经阅读了所有关于如何在网页底部创建页脚的教程,但我仍然无法为我的网站创建页脚 我提到的链接是 这一切都不管用 CSS 这是我网站的虚拟小提琴 这是我试过的小提琴,但里面也有一个bug 试试这个: <div id="container"> <div id="content"></div> </div> <div id="footer">My Sticky Footer</div> 添加/编辑如下 #body { ma

我已经阅读了所有关于如何在网页底部创建页脚的教程,但我仍然无法为我的网站创建页脚

我提到的链接是

这一切都不管用

CSS

这是我网站的虚拟小提琴

这是我试过的小提琴,但里面也有一个bug

试试这个:

<div id="container">
  <div id="content"></div>
</div>
<div id="footer">My Sticky Footer</div>
添加/编辑如下

#body {
margin-bottom: 85px;
position: relative;
}

#footer1 {
position: fixed;
}
我想这就是你想要的

* html #form1 {
    height:100%; 
}

#form1 {
    min-height: 100%;
    position: relative;
}

#body {
    padding-bottom: 50px; /* padding-bottom should be equal to the footer height (this keeps the footer from overlapping the content) */
}

#footer1 {
    position: absolute;
    width: 100%;
    clear: both;
    bottom: 0;
    padding: 0;
    margin: 0;
}
遵循代码-您需要:

1将页脚放在表单外部

2.在表格上添加高度:100%

3根据页脚的高度设置底边距的负数

form {
    min-height: 100%;
    height: 100%;
    margin: 0 auto -150px; /*footer 150px high */
}

搜索可能重复:谷歌中的“粘性页脚”。@Danield它不起作用。。!!我已经找过了it@KarlViiburg我已经使用了你在链接中建议的方法,但我仍然无法将其置于底部现在你的问题要好得多:如果你想使用这种方法,你还应该添加一个等于你的页脚到车身高度的填充物。我不希望页脚被固定,我希望它位于车身底部网页。。!!嘿,这在我的情况下不起作用…:谢谢你的时间。。!我不希望页脚被修复我希望它在页面底部我不明白,页脚在页面底部?你们的意思是无论滚动位置如何,页脚每次都应该在页面底部吗?
* html #form1 {
    height:100%; 
}

#form1 {
    min-height: 100%;
    position: relative;
}

#body {
    padding-bottom: 50px; /* padding-bottom should be equal to the footer height (this keeps the footer from overlapping the content) */
}

#footer1 {
    position: absolute;
    width: 100%;
    clear: both;
    bottom: 0;
    padding: 0;
    margin: 0;
}
form {
    min-height: 100%;
    height: 100%;
    margin: 0 auto -150px; /*footer 150px high */
}