我在让页脚停留在底部时遇到问题 我已将其设置为 position: fixed;但如果内容发生变化,它仍然会出现。另外,我无法更改背景颜色。我的代码有什么我没有看到的问题吗?
HTML:
<div id="footer">
<div class="container">
<span class="left text-muted">content </span>
<span class="right">
Content
</span>
</div>
</div>
CSS:
.footer {
height: 60px;
background-color: #939598;
position: fixed;
}
.left {
float:left;
align: left;
}
.right {
float:right;
}
最佳答案
您使用了错误的选择器。
它应该是基于 id 的选择器 #footer
而不是基于类的 .footer
。
#footer {
height: 60px;
width: 100%;
background: #939598;
position: fixed;
bottom: 0px
}
.left {
float: left;
}
.right {
float: right;
}
<div id="footer">
<div class="container">
<span class="left text-muted">content </span>
<span class="right">
footer Content
</span>
</div>
</div>
关于html - 粘性页脚和页脚颜色不变,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33770296/