How can i put a nav that uses half of the screen on the left side and that on the right side i can scroll down without the nav moving
What I’m trying to get is something like the images that I’m going to put:
I tried using position: sticky;
for the nav
and using flex-direction: column;
for the right hand column but it didn’t work.
2
Answers
position: fixed;
is probably what you are looking for. If you apply it to the nav, it will always stay where it is, even if you scroll. Be aware, that when you do that, other elements might end up behind the nav.Also, it’d be very helpful, if you provided some code we could try. Without the code, this is the best I can do.
One of the most efficient ways to solve this is the usage of a 2-column grid. As a direct child of the grid container (body in this case), you use an
aside
element and amain
element as the main content.Within the
aside
you can place thenav
and useposition: sticky; top: 0;
to keep the navbar within the viewport.