I am trying to set up a sticky navbar in angular 6.
but it ends up looking like this, the main content overlapping with my navbar when scrolling down (it's like scrolling through under it)
i have already tried setting the z-index of the nav class.
i've also tried putting divs around the router-outlet in the app.component.html and offset it, but this didn't work either
glad for your help!
the scss for the navbar looks like this:
.nav {
position: sticky;
top: 0;
background: $primary-color;
}
.nav-container {
display: grid;
grid-template-areas: 'home members list messages . loginForm';
grid-template-rows: 50px;
grid-template-columns: 100px 100px 100px 100px 1fr auto;
}
my app.component.html like this
<app-nav></app-nav>
<router-outlet></router-outlet>
the html of this particular page looks like this:
<div class="grid-container" style="height: 500px">
<div class="header"></div>
<div class="sidebar"></div>
<div class="main"></div>
<div class="footer"></div>
</div>
<div class="grid-container" style="height: 500px">
</div>
<div class="grid-container" style="height: 500px">
</div>
<div class="grid-container" style="height: 500px">
</div>
<div class="grid-container" style="height: 500px">
</div>
and finally the scss of the page:
.grid-container {
display: grid;
grid-template-areas:
'header header'
'sidebar main'
'footer footer';
grid-template-columns: 100px 1fr;
grid-template-rows: 50px 1fr 50px;
}