Having an issue with my code regarding the menu. I am trying to create a navbar that fills the height on the left side for PC screens and becomes scrollable at the top for mobile versions.
The problem lies in my flex container not properly filling the screen height, causing it to overflow at the bottom. Here is my code:
/* css */
body {
margin: 0;
}
#main-doc {
width: 100%;
display: flex;
flex-flow: row wrap;
}
#container-nav {
position: fixed;
height: 100%;
width: 13.35em;
display: flex;
flex-direction: column;
background-color: red;
}
#nav-header {
flex-grow: 1;
flex-shrink: 1;
flex-basis: auto;
}
.nav-link {
flex-grow: 1;
flex-shrink: 1;
flex-basis: auto;
background: green;
}
#container-nav {
padding: 1em;
display: flex;
flex-direction: column;
}
@media screen and (max-width: 780px) {
#container-nav {
position: absolute;
width: 100%;
padding: 0;
overflow-y: scroll;
height: 20%;
border-right: none;
}
#main-doc {
display: flex;
flex-flow: column wrap;
}
#nav-header {
flex: 0;
}
.nav-link {
flex: 0;
padding: 1em;
}
}
<!-- html -->
<main id="main-doc">
<nav id="navbar">
<div id="container-nav">
<header class="nav-link" id="nav-header">Flexbox Documentation</header>
<a src=# class="nav-link">About</a>
<a src=# class="nav-link">Basics</a>
<a src=# class="nav-link">Flex Container Properties</a>
<a src=# class="nav-link">Flex Items Properties</a>
<a src=# class="nav-link">Examples</a>
</div>
</nav>
</main>