mle*_*egg 0 html css bootstrap-4
我使用 Bootstrap 4 重新制作了一个页面,但似乎无法弄清楚为什么页脚背景颜色没有显示。页面在这里
.footer {
width: 100%;
font-size: 1.5rem;
text-align: center;
overflow: visible;
color: #004289;
font-weight: bold;
height: 2rem;
background-color: #CFFEEE;
} Run Code Online (Sandbox Code Playgroud)
<footer class="footer">
<div class="container">
<div class="text-center">Copyright © <script>document.write(new Date().getFullYear());</script> The Driftwood</div>
</div>
</footer>Run Code Online (Sandbox Code Playgroud)
我想我的大脑正在为一些本应如此简单的事情而爆炸。谢谢编辑:在下面的运行代码片段管理器中看起来我想要的样子。如果您需要更多代码,请询问或查看实时页面。这就是我所看到的

在头部部分,我链接到 BS css 和我的自定义 css,如下所示
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/css/bootstrap.min.css" integrity="sha384-/Y6pD6FV/Vv2HJnA6t+vslU6fwYXjCFtcEpHbNJ0lyAFsXTsjBbfaDjzALeQsN6M" crossorigin="anonymous">
<link href="dist/css/custom-bs4.css" rel="stylesheet">
Run Code Online (Sandbox Code Playgroud)
您的.container白色背景会覆盖它,因为它是比 更具体的选择器.footer。
要覆盖你可以这样做:
.footer .container {
background-color: #CFFEEE;
}
Run Code Online (Sandbox Code Playgroud)