.nav {
display: flex;
background: dodgerblue;
position: sticky;
top: 0;
}
.links-container {
display: flex;
float: right;
}
<header class="nav">
<h1 class="logo">Learn to code</h1>
<div class="links-container">
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
</div>
</header>
I have tried position relative on the link container and that didn't work either.