I cant fix my navbar to show at the top

<!DOCTYPE html>
<html>
    <head>
        <title>My Portfolio</title>
        <link  rel="stylesheet" href="styles.css">
        <meta charset="UTF-8">
        <meta name="viewport"> 
    </head>
    
    <body>



<section id="welcome-section">
     <header>
        <h1 class="title">Hey I am Matija</h1>
        <p class="welcum">a web developer</p>
     </header>   
    </section>
    
    <nav class="nav"></nav>
<ul class="navbar">
<li>
    <a href="#welcome-section">About</a>
</li>
<li>
    <a href="#projects">Work</a>
</li>
<li>
    <a href="#contact">Contact</a>
</li>
</ul>
</nav> 
        
       
      
    <div class="background">
        
    </div>
    <section class="project">
    <div class="projects">
        
    </div>
</section>
<section class="recruit">
    <div class="contact"></div>
</section>

    </body>
    
</html>

CSS:

*{
    margin: 0;
    padding: 0;
}
.nav{
    z-index: 300;
    display: flex;
    justify-content: flex-end;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: red;
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.4);
    
}
h1,p{ 
    
    color: white;
    padding: 0;
    margin: 0;
    
}
body{
    z-index: 100;
position: relative;
display: flex;

width: auto;
height: 100vh;
border-radius: 0px;
background-image: linear-gradient(62deg, #3a3d40 0%, #181719 100%); 
 margin : 0;
 padding: 0;


}

#welcome-section{
    justify-content: center;
    display: block;
  margin: 0 auto;
    z-index: 1000;
    text-align: center;
    margin-top: 160px;
    
}

h1{
    font-family: 'Poppins', sans-serif;
    font-size: 50px;
    font-weight: 150;
    padding-top: 200px;
    
}
.welcum {
   z-index: 2;
    font-size: 1.4rem;
    font-weight:0;
    font-style: italic;
    color: orangered;
    font-family: 'Poppins', sans-serif;
   
    
}

html{
    scroll-behavior: smooth;
}

Navbar wont show at the top of the screen please help

You closed the nav element too soon (and twice).

  <nav class="nav"></nav> <!-- closed -->
  <ul class="navbar">
    <li>
      <a href="#welcome-section">About</a>
    </li>
    <li>
      <a href="#projects">Work</a>
    </li>
    <li>
      <a href="#contact">Contact</a>
    </li>
  </ul>
  </nav> <!-- closed again -->

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.