在我的页面上滚动时,我的页脚不会停留在下方。有什么建议吗?
页脚的 CSS:
.footer {
position: fixed;
left: 0;
bottom: 0;
width: 100%;
text-align: center;
color: #f2f2f2;
margin: 0;
height: 150px;
background-color: #399D60;
}
关于如何解决这个问题有什么想法吗?
最佳答案
如果您的 html 结构如下所示:
<footer>
<!-- Your footer content go here -->
</footer>
那么你的css应该是
footer {
/* Your css should go here*/
/* not .footer, use footer */
}
或者你可以给它一个类 footer
这样你就可以用 .footer
定位
<footer class="footer">
<!-- Your footer content go here -->
</footer>
现在您可以使用 .footer
等类选择器来定位它
关于html - 粘性页脚不会停留下来,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55170222/