我目前正在创建一个网页,我想在顶部放置一个导航栏,但出于某种原因,即使我在我的 CSS 中将其颜色设置为黑色,它也没有显示。我需要标题“JG.OFFICIAL”在导航内,因为它有 Logo 。但它似乎效果不佳,欢迎提供一些建议。
我的网站:https://jgofficial1.000webhostapp.com/index.html
这是我的代码:
h1 {
color: white;
font-family: 'Montserrat', sans-serif;
height: 40px;
width: 70px;
}
body {
background-image: url("../images/hello.jpg");
background-size: cover;
position: fixed;
}
nav {
color: black;
height: 60px;
width: 100%;
}
<link href="https://fonts.googleapis.com/css?family=Montserrat:600" rel="stylesheet">
<nav>
<div class="header-logo">
<h1>JG.OFFICIAL</h1>
</div>
<ul>
<li><a href="index.html">HOME</a>
</li>
<li><a href="work.html">WORK</a>
</li>
</ul>
</nav>
<h2>There's Still a bit of work to be done, come back soon</h2>
最佳答案
如果这就是您要查找的内容,您应该在 nav
中声明 background: black;
。
关于html - 如何在背景顶部添加导航栏?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47753078/