我试图强制我的页脚位于网站底部。我不希望它在滚动时粘住,只是在向下滚动网页时出现在底部。
目前 - 网页显示时页脚位于内容下方。
我添加了这样的代码bottom:0;
并发现它粘住了并且不适合我的网站。我还添加了这样的代码html, body { height:100%;}
正如在其他 stackoverflow 问题上所看到的那样 - 但没有任何乐趣。
任何意见,将不胜感激。
Code:
.footer {
background: #F37A1D;
position : absolute;
width: 100%;
border-top: 3px solid #F37A1D;
}
<div class="footer">
<div class="container">
<p>© COMPAY 2015</p>
</div>
</div>
*{
padding: 0;
margin: 0;
}
html {
position: relative;
min-height: 100%;
}
body {
/* Margin bottom by footer height */
margin-bottom: 60px;
}
.footer {
position: absolute;
bottom: 0;
width: 100%;
/* Set the fixed height of the footer here */
height: 60px;
background: #F37A1D;
border-top: 3px solid #F37A1D;
}
<div class="footer">
<div class="container">
<p>© COMPAY 2015</p>
</div>
</div>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)