After deciding to experiment with CSS-grid, I encountered a frustrating roadblock. My goal was to create two fixed navigation bars on the left and right sides, with the main content in the center that would be scrollable.
<div class="grid">
<div class="sidebar-left">
1
</div>
<div class="sidebar-right">
2
</div>
<div class="main-content">
Lorem Ipsum text here...
</div>
</div>
Here is my CSS code snippet:
.grid {
display: grid;
grid-template-columns: 10vw auto 10vw;
}
.sidebar-left {
position: fixed;
width: 10vw;
background: red;
}
.sidebar-right {
width: 10vw;
background: blue;
position:fixed;
right:0;
}
.main-content {
background: yellow;
}
Issue: Struggling to correctly position the main-content div between the two sidebars.
Attempts to fix: Tried various solutions from StackOverflow, but the layout gets disrupted by the second nav bar.
You can view the full CodePen example here.