I want my css code to do this:
But it ended up like this:
How do I make the word "NEXT" go on top of the black background? And I am not sure where did my other links go, how do I align it and make my other links a white color? The #fff in my CSS code doesn’t seem to be working.
Could someone review my code?
* {
box-sizing: border-box;
margin: 0;
padding: 0;
font-family: 'Kumbh Sans', sans-serif;
}
.navbar {
background: #131313;
height: 80px;
display: flex;
justify-content: center;
align-items: center;
font-size: 1.2rem;
position: sticky;
top: 0;
z-index: 999;
}
.navbar__container {
display: flex;
justify-content: space-between;
height: 80px;
z-index: 1;
width: 100%;
max-width: 1300px;
margin: 0 auto;
padding: 0 50px;
}
#navbar__logo {
background-color: #ff8177;
background-image: linear-gradient(to top, #ff0844 0%, #ffb199 100%);
background-size: 100%;
-webkit-background-clip: text;
-moz-background-clip: text;
-webkit-text-fill-color: transparent;
-moz-text-fill-color: transparent;
display: flex;
align-items: center;
cursor: pointer;
text-decoration: none;
font-size: 2rem;
}
.fa-gem {
margin-right: 0.5rem;
}
.navbar__menu {
display: flex;
align-items: center;
list-style: none;
text-align: center;
}
.navbar__item {
height: 80px;
}
.navbar__links {
color: #fff;
display: flex;
align-items: center;
justify-content: center;
text-decoration: none;
padding: 0 1 rem;
height: 100%;
}
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!--idk what this is at the top ^ but vscode automatically writes it for me.-->
<title>NEXT Website</title>
<link rel="stylesheet" href="style.css">
<!--this is linking to style.css ^-->
<nav class="navbar"></nav>
<!--I need to review what "nav" does-->
<div class="navbar__container">
<a href="/" id="navbar__logo">NEXT</a>
<div class="navbar__toggle" id="mobile-menu">
<span class="bar"></span>
<span class="bar"></span>
<span class="bar"></span>
</div>
<!-- ^ this looks like some sort of list idk what it means-->
<ul class="navbar__menu">
<li class="navbar__item">
<a href="/" class="navbar__links">Home</a>
</li>
<li class="navbar__item">
<a href="/tech.html" class="navbar__links">Tech</a>
</li>
<li class="navbar__item">
<a href="/" class="navbar__links">Products</a>
</li>
<li class="navbar__btn">
<a href="/" class="button">Sign Up</a>
</li>
</ul>
</div>
2
Answers
You close your
<nav>
element straight away, so none of the things you want to be inside it actually are. Close it after the rest.UPDATE:
I tried to prepare your code in a similar way from the beginning. You can check it from below code snippet. I hope it works for you.