I have a left div with id sideNav
and a right main
div like this
#sideNav {
background-color: #012d20;
position: fixed;
z-index: 1;
top: 0;
left: 0;
overflow: hidden;
border-right-style: groove;
height: 100vh;
}
<div class="row">
<!-- navigation sidebar -->
<div class="col-2 pt-5" id="sideNav">
...
</div>
<!-- main content area -->
<main class="col-10">
...
</main>
</div>
The code works but the left part of main
is now inside behind the sideNav. When I remove the position property of the sideNav
css, my divs are displayed correctly again but sideNav
is no longer fixed and scrolls with the page.
How do I keep sideNav
fixed and my divs properly displayed?