body {
background-color: black;
color: #6e07a6;
font-size: 16px;
font-family: 'Poppins', sans;
font-weight: 400;
}
.header-part {
width: 100%;
height: 5rem;
background-color: #6e07a6;
color: white;
margin: 0;
padding: 0;
top: 0;
display: flex;
align-items: center;
}
#header {
display: flex;
align-items: center;
width: 100%;
}
.nav-links {
display: flex;
list-style: none;
text-decoration: none;
justify-content: space-evenly;
align-items: center;
width: 100%;
}
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Test site</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="style.css">
<link href="https://fonts.googleapis.com/css2?family=Poppins:[email protected];500&display=swap" rel="stylesheet">
</head>
<body>
<div class="header-container">
<div class="header-part">
<header id="header">
<ul class="nav-links">
<li class="nav-link">Home</li>
<li class="nav-link">Projects</li>
<li class="nav-link">Contact</li>
<li class="nav-link"><span class="sign-in">Sign in / Login</span></li>
</ul>
</header>
</div>
</div>
<div class="main-page">
</div>
</body>
</html>
I set the display types for your wrapping elements, and also defined their width to fill the purple area. By default they are set to display: block;